Reputation: 1801
I am storing the user information in my database along with other attributes such as his annual leave/vacation balance.
The user annual leave would be 14 days every year but I want to refresh it every year and add another 14 to it. If the user had 3 days of annual leave left at year's end, then he would start the new year with a 17 day balance.
Upvotes: 0
Views: 273
Reputation: 20256
Just use the percolate:synced-cron package to create an annual job to update such balances.
You might also need a lastUpdatedDate
to make sure you don't accidentally add to the balance twice. You have to anticipate any errors that would leave your data partially-updated.
Upvotes: 1