I want to display some statistics of data stored in array of arrays. I have three categories (video,article,webinar) but it could expand later on. The structure of statistics per category will be almost the same. Like: total number of videos, last date when added new record in category, etc.
So far I can think of a hash of an array to store the stats. Where the array would hold the structure of stats per category and would be the (almost) same for all categories. Could anybody think of any better solution in terms of
- being easy to include new category
- easy to manipulate/assign/calculate all the statistical data
- easy to display
my idea looks like
stats = { 'video' = [], 'article' = [], 'webinar' = [] }
stats_array = ['Total number','Last date added','etc']
and then I would do something like
stats['video'][stats_array.index('Total number')] +=1