Hi all, I''m creating a statistics system for events. When an event has passed, an admin can enter statistics for that passed event. Every user attending the event and the event itself have statistics. The problem is that depending on the type of the event, the type of statistics for both users and event can change. eg: for one event the number of remarks and time present will be registered for another event the name of the company he represents I''m struggling on how to implement this especially database wise. I can ofcourse create a table that contains all possible statistics data and than only fill in the rows that matter for that event. the downside is that I lose a lot of storage since a lot of rows are left blanc. maybe someone has an idea on how to solve this? thanks in advance. Stijn --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Tarscher wrote: The problem> is that depending on the type of the event, the type of statistics for > both users and event can change. eg: for one event the number of > remarks and time present will be registered, for another event the name > of the company he representsYou could approach this with a key-key value type of table definition. STATISTIC: EVENT_ID STAT STAT_TYPE STAT_STRING EVENT_ID can link back to the event STAT is the name of each statistic, like REMARK_COUNT, TIME_PRESENT, or COMPANY_NAME, however many you''d like to keep (I''d probably keep the valid list in another table). STAT_TYPE is the data type of the value "stored", which directs you to which of the remaining fields holds the valid value for this record. STAT_STRING is the stringified version of the data. You could record any number of different statistics for any event, it''s row-heavy, column-light, and has some of its own issues, but it''s workable. I''m sure there''s a better approach, but it''s been like 10 years since I worked on an issue where I wanted to store an arbitrary collection of attributes. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ar Chron wrote:> STAT_TYPE is the data type of the value "stored", which directs you to > which of the remaining fields holds the valid value for this record.Arrgh... no edit... STAT_TYPE is the data type of the value stored, which tells you the transformation to apply to STAT_STRING... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---