-
Notifications
You must be signed in to change notification settings - Fork 30
feat: add support for new highscore categories #563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for new highscore categories #563
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #563 +/- ##
=======================================
Coverage 79.44% 79.44%
=======================================
Files 22 22
Lines 2807 2807
=======================================
Hits 2230 2230
Misses 439 439
Partials 138 138 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds support for two new highscore categories: "bountypoints" and "weeklytasks". The changes introduce new enum values, update validation logic to recognize common variants of these category names, add corresponding test cases, and update API documentation to reflect the new categories.
Key Changes:
- Added
HighScoreBountypointsandHighScoreWeeklytasksenum values to theHighscoreCategorytype - Extended validation to recognize "bountypoints", "bountypoint", "bountypointsearned", "weeklytasks", "weeklytask", and "weeklytaskscompleted" as valid category inputs
- Added test cases covering all string variants for both new categories
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/webserver.go | Updated Swagger/API documentation to include "bountypoints" and "weeklytasks" in the category parameter enum list |
| src/validation/highscore_test.go | Added test cases for "Bountypoints" and "Weeklytasks" categories covering all their string variants |
| src/validation/highscore.go | Added new enum constants, updated valid categories list, and added switch cases for mapping string inputs to the new enum values |
Comments suppressed due to low confidence (1)
src/validation/highscore.go:53
- The
String()method needs to be updated to support the new highscore categories. Currently, it only handles categories up toHighScoreBosspoints(line 49), but the new enumsHighScoreBountypointsandHighScoreWeeklytaskshave been added.
The seasons array on line 48 should include "bountypoints" and "weeklytasks", and the range check on line 49 should be updated to hc > HighScoreWeeklytasks to include the new categories.
func (hc HighscoreCategory) String() (string, error) {
seasons := [...]string{"achievements", "axefighting", "charmpoints", "clubfighting", "distancefighting", "experience", "fishing", "fistfighting", "goshnarstaint", "loyaltypoints", "magiclevel", "shielding", "swordfighting", "dromescore", "bosspoints"}
if hc < HighScoreAchievements || hc > HighScoreBosspoints {
return "", errors.New("invalid HighscoreCategory value")
}
return seasons[hc-1], nil
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



This pull request adds support for two new highscore categories, "bountypoints" and "weeklytasks", throughout the validation logic and API documentation. The changes ensure that these categories are recognized as valid, properly mapped in the code, and covered by tests.
Highscore category support:
validHighscoreCategoriesinhighscore.go.HighScoreBountypointsandHighScoreWeeklytasksto theHighscoreCategorytype.HighscoreCategoryFromStringfunction to map string inputs for "bountypoints" and "weeklytasks" to their respective enum values.Testing and documentation:
highscore_test.go.categoryparameter to include "bountypoints" and "weeklytasks" as valid enum values inwebserver.go.fix #562