In my app , each week , I need to present a statistics report: events number , active volunteer number etc.
All those numbers I get from different sql function in a certain controller , which take the info from different models , and being echoed in an html table.
However , as the DB changes (more volunteers are added/deleted - for example) so will the echoed data change as well , which will be not accurate to that date.
So in order to "fix" the numbers I came up with the following solution:
-
Create a Report model , containing all those fields.
-
Using Report’s create action , run all those sql functions
-
set a cron job to run it once a week
And so I’ll get fixed reports each week , which will not change
What is your opinion about this solution?
Am I trying to re-invent the wheel here or this is the way reports are being made?
Thanks,
Mark.