refactor(Elo): Refactoring of the Elo classes. - #50
Open
Skyaero42 wants to merge 4 commits into
Open
Conversation
- 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.
Contributor
|
I guess you already realized but just a heads-up that most of this is unused code. |
Author
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
initialization is centralized to increase maintainability
refactor(elo): Refactor Elo logic for robustness
when the result value did not match a predefined enum value.
refactor(elo): Use const instead of static for EloConfig
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.