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

Stats: add checks to prevent decreasing #2106

Merged
merged 4 commits into from
Aug 30, 2024

Conversation

leandroalonso
Copy link
Member

We have a few reports from users that they stats decreased.

This PR adds a few checks to make that not possible:

  1. If the time being saved is smaller than what we currently have on UserDefaults we do not save it
  2. If any value smaller than zero is given, it's ignored

Ps.: in the case of corrupted UserDefaults this doesn't address it.

To test

  1. Run the app and login to an account
  2. Check your stats
  3. Listen for a episode for a few seconds
  4. Profile > Refresh Now
  5. Go to Stats
  6. ✅ Your stats should increase

Checklist

  • I have considered if this change warrants user-facing release notes and have added them to CHANGELOG.md if necessary.
  • I have considered adding unit tests for my changes.
  • I have updated (or requested that someone edit) the spreadsheet to reflect any new or changed analytics.

@leandroalonso leandroalonso added the [Type] Bug Used for issues where something is not functioning as intended. label Aug 28, 2024
@leandroalonso leandroalonso added this to the 7.72 milestone Aug 28, 2024
@leandroalonso leandroalonso requested a review from a team as a code owner August 28, 2024 17:33
@leandroalonso leandroalonso requested review from bjtitus and removed request for a team August 28, 2024 17:33
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 7.72. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@leandroalonso leandroalonso changed the title Stats: add checks to prevent reducing Stats: add checks to prevent decreasing Aug 28, 2024
Copy link
Contributor

@bjtitus bjtitus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Stats increased after playback + refresh

@leandroalonso leandroalonso merged commit 88d4d40 into trunk Aug 30, 2024
4 of 6 checks passed
@leandroalonso leandroalonso deleted the stats/changes-to-prevent-wrong-sync branch August 30, 2024 11:27
@danielebogo danielebogo mentioned this pull request Sep 4, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug Used for issues where something is not functioning as intended.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants