So my app is operating on a credit system. Each user gets 30 credits upon registration, and they can use those credits to do certain tasks in my app.
I’m trying to figure out how can I reset each user’s credits back to 30 every 7 days .
I am having no luck with the countdown component as the timer resets after navigating to a different page.
The same idea I’m looking for. We hope for help from the experts.
You have to use dates.
A date when you assign the credits and then compare that to today’s date. If the difference is 7, set credits to 30.
I’m assuming that “Credits” is a number parameter in your user’s collection.
Add a Date parameter to the collection and call it “Reset date”. When the user signs up, set this automatically to “Date & Time > Current Time”.
On the home screen, drop in a countdown timer. Set the visibility to sometimes visible if Logged-in User > Reset Date > is before > 6 days ago.
Last, set the countdown finished action to update the logged in user. Set the amount of credits you’d like (in this case, you said 30) and set the reset date to the current time.
Thanks for the really detailed reply man!
Will this automatically reset the credits every 7 days?
Also, is this for one 7 day cycle or will this continue to execute without having to update the number of seconds in the countdown timer?
Thanks once again! I’m gonna try this out for sure.
EDIT: Also, since the countdown widget resets itself after visiting another page, do you think this will affect the logic?
If a user has 30 credits on day 1 and uses 15 credits, on day 7, the credits reset to 30 if the user logs in. The countdown timer will only reset when the user visits the home screen after the 7 days.
So if the user uses 30 credits but doesn’t log in for 30 days, when the user logs in on the 30th day, it will reset the credits and set a new reset date.
It will not affect the logic since the countdown timer isn’t being reset while it’s hidden. It only gets reset when it’s displayed.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.