Skip to content

Conversation

@tobiasehlert
Copy link
Member

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:

  • Added "bountypoints" and "weeklytasks" (with common variants) to the list of valid highscore categories in validHighscoreCategories in highscore.go.
  • Introduced new enum values HighScoreBountypoints and HighScoreWeeklytasks to the HighscoreCategory type.
  • Updated the HighscoreCategoryFromString function to map string inputs for "bountypoints" and "weeklytasks" to their respective enum values.

Testing and documentation:

  • Added new test cases for "bountypoints" and "weeklytasks" to ensure correct mapping in highscore_test.go.
  • Updated API documentation for the category parameter to include "bountypoints" and "weeklytasks" as valid enum values in webserver.go.

fix #562

@tobiasehlert tobiasehlert requested a review from Copilot December 7, 2025 10:37
@tobiasehlert tobiasehlert self-assigned this Dec 7, 2025
@tobiasehlert tobiasehlert added enhancement New feature or request go Pull requests that update Go code labels Dec 7, 2025
@codecov
Copy link

codecov bot commented Dec 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.44%. Comparing base (259b2b0) to head (74dd37c).
⚠️ Report is 2 commits behind head on main.

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a 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 HighScoreBountypoints and HighScoreWeeklytasks enum values to the HighscoreCategory type
  • 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 to HighScoreBosspoints (line 49), but the new enums HighScoreBountypoints and HighScoreWeeklytasks have 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.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 7, 2025

Copy link
Contributor

Copilot AI left a 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.

@tobiasehlert tobiasehlert merged commit 11ad54d into main Dec 7, 2025
14 checks passed
@tobiasehlert tobiasehlert deleted the feat-add-support-for-new-highscore-categories branch December 7, 2025 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update Go code

Development

Successfully merging this pull request may close these issues.

feat: add new highscore categories

2 participants