-
Notifications
You must be signed in to change notification settings - Fork 134
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: apply API changes to prevent reset #2541
base: trunk
Are you sure you want to change the base?
Conversation
@@ -29,6 +29,39 @@ public class StatsManager { | |||
} | |||
} | |||
|
|||
func updateStatsIfNeeded(savedDynamicSpeed: TimeInterval, savedVariableSpeed: TimeInterval, totalListenedTo: TimeInterval, totalSkipped: TimeInterval, savedAutoSkipping: TimeInterval) { | |||
let minimumStatsChangeToUpdate = 100 |
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.
I'm debating whether this should be 100
or something bigger or smaller.
Maybe if the local stat is just smaller than remote we should update?
let minimumStatsChangeToUpdate: TimeInterval = 100 | ||
|
||
updateQueue.sync { | ||
if savedDynamicSpeed - self.savedDynamicSpeed > minimumStatsChangeToUpdate { |
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.
Nit: Do you want to save only if the difference is positive right? No need to use abs
?
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.
Followed the test instructions and the stats recovered to the correct values.
Just left a small nit that you may want to consider, but feel free to ignore if does not make sense for the scenario.
We had a few instances of users' complaining that their Stats reset or reduced. This PR applies the latest changes deployed on Staging ensuring:
To test
Build Configuration
toStaging
and run the appupdateQueue.sync
block from theStatsManager
init
method. This will simulate having negative statsChecklist
CHANGELOG.md
if necessary.