You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When opening the app for the first time each day, a dialog pops up showing the number of check-ins required before the next login incentive prize. This number is not calculated correctly; instead, it shows the number of total check-ins required for the next incentive.
e.g.: when checking in on the 15th day, the dialog says:
Next prize in 18 Check-ins
but it should say
Next prize in 3 Check-ins
To Reproduce
Steps to reproduce the behavior:
Open the app for the first time in a day
Note the daily check-in dialog
The number displayed ("Next prize in X Check-ins") shows the total number of check-ins required for the next incentive (not the number remaining).
(Android Version 4.0.5 (4760))
Expected behavior
The number shown in the check-in dialog should be the number of check-ins remaining until the next incentive.
Screenshots
Screenshot shows "18 Check-ins" remaining, when the next reward is unlocked at 18 total check-ins. It should show "3 Check-ins".
Smartphone (please complete the following information):
OS: Android 13
App Version: Version 4.0.5 (4760)
Additional context
The offending line appears to be here (ShowNotificationInteractor.kt)
val nextUnlockText = activity.getString(R.string.nextPrizeUnlocks, notificationData?.nextRewardAt)
I think the nextRewardAt contained in the notification comes from the server, and is calculated in loginIncentives.js. This field, stored on each incentive, represents the number of total check-ins required to reach the next incentive (e.g. the incentive earned at 450 check-ins holds 475 as it's nextRewardAt, since the next incentive in order requires 475 total check-ins).
This number is not relative to the player's current number of check-ins; it does not change. In order to show the number of additional check-ins the player needs before reaching the next incentive, the player's current total check-ins needs to be subtracted from the nextRewardAt (e.g. 475 - 468 = 7 == check-ins to next prize).
This calculation is done correctly in both the web app and the iOS app before showing the message:
Describe the bug
When opening the app for the first time each day, a dialog pops up showing the number of check-ins required before the next login incentive prize. This number is not calculated correctly; instead, it shows the number of total check-ins required for the next incentive.
e.g.: when checking in on the 15th day, the dialog says:
but it should say
To Reproduce
Steps to reproduce the behavior:
(Android
Version 4.0.5 (4760)
)Expected behavior
The number shown in the check-in dialog should be the number of check-ins remaining until the next incentive.
Screenshots
Screenshot shows "18 Check-ins" remaining, when the next reward is unlocked at 18 total check-ins. It should show "3 Check-ins".
Smartphone (please complete the following information):
Version 4.0.5 (4760)
Additional context
The offending line appears to be here (
ShowNotificationInteractor.kt
)I think the
nextRewardAt
contained in the notification comes from the server, and is calculated inloginIncentives.js
. This field, stored on each incentive, represents the number of total check-ins required to reach the next incentive (e.g. the incentive earned at 450 check-ins holds475
as it'snextRewardAt
, since the next incentive in order requires 475 total check-ins).This number is not relative to the player's current number of check-ins; it does not change. In order to show the number of additional check-ins the player needs before reaching the next incentive, the player's current total check-ins needs to be subtracted from the
nextRewardAt
(e.g.475 - 468 = 7 == check-ins to next prize
).This calculation is done correctly in both the web app and the iOS app before showing the message:
Web app: (https://github.com/HabitRPG/habitica/blob/develop/website/client/src/components/achievements/login-incentives.vue#L85)
iOS: (https://github.com/HabitRPG/habitica-ios/blob/develop/HabitRPG/Utilities/NotificationManager.swift#L178)
It looks like the Android app needs to make this calculation as well, something like:
This should be straightforward, but I can't tell if the user is readily available in this context; it looks like it might not be.
An alternative might be to make the calculation on the server side and include it in the notification.
The text was updated successfully, but these errors were encountered: