Creating Statistic Reports

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:

  1. Create a Report model , containing all those fields.

  2. Using Report’s create action , run all those sql functions

  3. 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?




i think your approach is ok for developing week status report :)

Yes. turned out really good , and I can even use the advanced search for listing between the reports.