I have a site where people can add their favorite TV shows.
I would like to have some trends statistics. Example:
- (1 unchanged) The Big Bang Theory
- (3rd last week) How I Met Your Mother
- (2nd last week) House
- (30th last week, up 400%) Nikita
I'm not sure how to design the database for this, but here is my idea:
- Once a week, I run a cronjob.
- The cronjob calculate each show's current position.
- Last weeks position gets copied over to another db-column.
- From these two values (columns), I can calculate the change.
Is this approach fine? How would you do it? :)
PS. I'm a Rails coder, but that should not matter, unless there is some plugins already made for a similar purpose.