I want to display some statistics of data stored in an array of arrays. I have three categories (video, article, webinar), but it can be expanded later. The structure of statistics by category will be almost the same. For example: the total number of videos, the last date when a new entry in the category was added, etc.
So far, I can provide an hash of the array for storing statistics. If the array contains the statistics structure for each category and is (almost) the same for all categories. Can anyone think of any better solution in terms of
- easy to include a new category
- easy to manipulate / assign / calculate all statistics
- 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