Skip to content

Code quality refactor of the PlayerRepository #304

Closed
@myssto

Description

@myssto

The PlayerRepository needs a bit of cleanup. Some methods need to be renamed, and the documentation on the interface should be polished.

Tasks:

  • Organize methods so that all private members come after public ones
  • Organize methods so that all overloads follow each other in order
  • Clean up XML documentation of IPlayerRepository (remove empty returns tags, use similar wording to other repos)
  • Per-method tasks
    • Rename GetPlayersMissingRankAsync to GetAllMissingRankAsync
    • Refactor GetAsync(bool eagerLoad) to be an overload of RepositoryBase.GetAllAsync()
    • Edit GetAsync(string username) to not throw an exception
    • Edit GetOrCreateAsync(long osuId) to use GetAsync(osuId) instead of checking for an existing entity first
    • Remove unused method GetAsync(long osuId, bool eagerLoad, int mode = 0, int offsetDays = -1)
    • Refactor GetTopRatingsAsync(int n, Ruleset ruleset)
      • Parameter int n to int limit
      • Use LINQ functions instead of SQL syntax
    • Identify and correct usages of Get{Property}Async (Many places where these are used call multiple of them in succession, which creates an unnecessary amount of database calls. Most can be fixed by simply calling GetAsync(int id) and using the resulting entity)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions