Skip to content

refactor(Elo): Refactoring of the Elo classes. - #50

Open
Skyaero42 wants to merge 4 commits into
GeneralsOnlineDevelopmentTeam:mainfrom
Skyaero42:refactor/elo
Open

refactor(Elo): Refactoring of the Elo classes.#50
Skyaero42 wants to merge 4 commits into
GeneralsOnlineDevelopmentTeam:mainfrom
Skyaero42:refactor/elo

Conversation

@Skyaero42

Copy link
Copy Markdown

Recommend Squash & Merge, but Rebase & Merge is also possible.

This PR refactors the Elo classes. There are multiple commits for easier review.

refactor(elo): Refactor EloData to use primary constructor

  • Added primary constructor
  • Point other constructions to primary constructor to ensure parameter
    initialization is centralized to increase maintainability
  • Replaced initialization of properties with constants from EloConfig.

refactor(elo): Refactor Elo logic for robustness

  • Renamed private methods to better reflect their function
  • Made ExpectedScore private as it is not publicly used.
  • Removed the use of MatchResult enum as it could introduce an error
    when the result value did not match a predefined enum value.
  • Refactored MatchHistory database to reduce code duplication.

refactor(elo): Use const instead of static for EloConfig

  • Replaced static with const and removed getters as the properties in
    EloConfig are not changed (and should not) change during runtime. This
    also increases performance as constants are read during compile time.

docs(elo): Add documentation text to public elements.

Disclaimer: this PR was made by a human.

- Added primary constructor
- Point other constructions to primary constructor to ensure parameter
  initialization is centralized to increase maintainability
- Replaced initialization of properties with constants from EloConfig.
- Renamed private methods to better reflect their function
- Made ExpectedScore private as it is not publicly used.
- Removed the use of MatchResult enum as it could introduce an error
  when the result value did not match a predefined enum value.
- Refactored MatchHistory database to reduce code duplication.
- Replaced static with const and removed getters as the properties in
  EloConfig are not changed (and should not) change during runtime. This
  also increases performance as constants are read during compile time.
@JoKeRZH429

Copy link
Copy Markdown
Contributor

I guess you already realized but just a heads-up that most of this is unused code.

@Skyaero42

Copy link
Copy Markdown
Author

I guess you already realized but just a heads-up that most of this is unused code.
As far as I can determine, this code is still used.

@JoKeRZH429

Copy link
Copy Markdown
Contributor

Database.MatchHistory.UpdateLeaderboardAndElo is not called anywhere after this commit 748abdc

But I think its still worth it to have the native leaderboards implementation, incase someone wants to self-host or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants