Topic: Help with sessions and data modeling for class project
Hi, I'm currently making a quiz based learning game for a sustainability class. The front end is a mix of custom design and Twitter Bootstrap. The basic structure is interactive slides interspersed with quiz questions. Users will earn badges for levels of mastery; the first level is what I'm turning in.
I'm falling behind on the project, and it's due in a week. Though it seems pretty straightforward, I'm a little worried since I've never done data modeling or sessions. I was hoping someone could look over what I had planned and tell me if it's ok or there are better alternatives.
I'm confused as far as a) sessions and b) modeling badges. I've already got the bulk of user modeling, courtesy of Devise.
So the basic idea here is that I need to keep track of the user's progress as he or she goes through the slides/quizzes so that he can come back later. To do this, I would simple set a session hash, like
session[:lesson_id] = <an id to distinguish the lesson>
session[:slide] = <the current slide number>
session[:cum_score] = <cumulative score>
Is that all there is? Is there a better way to do this? Any general advice on sessions?
BADGES: Once the user reaches the final slide and has a high enough score, he or she will be awarded a badge. This seems a bit tricky: a many to many relationship.
So I picture three tables: 1) Users, 2) Awards, and 3) Badges
The badges table will hold all the different kinds of badges, while the Awards table will act as an association table and link a user_id to a badge_id. In other words, the awards table will have two columns, user_id and badge_id.
Does this sound about right? Thanks!