Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I had to solve this for charges and interest and I solved it in a more elegant way than described (I think).

Using mutation iterator, last update time and knowing the rate of change over time you can back apply any any calculations that have been missed regardless of how long it’s been since your cron job ran.

I setup a server to run the job on startup and 1 time a day at midnight. This also allows multiple different charges and interests to be applied to the same account. I also set it up to apply this process every time an account was accessed to make sure the accounts were up to date.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: