Skip to content
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

fix(UpdatePlayerBeatenGamesStatsAction): handle resets to zero correctly #3202

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wescopeland
Copy link
Member

Resolves #2743. Addresses https://retroachievements.org/viewtopic.php?t=29707&c=265715#265715.

Currently, when resetting achievements which also cause beaten awards to get deleted, it's possible to fall into a situation where player_stats is not correctly updated and hangs on to old data.

How to reproduce:

  • Be sure Horizon is running locally.
  • Create a new account.
  • On admin.php, give the new account a hardcore unlock for achievement ID 3317.
  • Observe on the new account's profile it now has a "Total Games Beaten" value of 1.
  • While logged in as the new account, reset that 1 achievement on your settings page.
  • Observe that "Total Games Beaten" on the account's profile is set to 1.

Root Cause
UpdatePlayerBeatenGamesStatsAction has safeguards to prevent writing rows where data is zero. However, these same safeguards are preventing transitions from 1 -> 0.

@wescopeland wescopeland requested a review from a team February 10, 2025 00:06
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.

Resetting a game should also update player_stats
1 participant