Stress time

Its the finals weeks som things are heating up. Playing with how to store the rating information. Whether there will be a static list of rating questions or a dynamic. And if its dynamic, which makes more sense, how will the votes be stored to keep out orphans. Fun stuff to mull over durring study breaks.

kevin's picture

Here's my stab. questions

Here's my stab.

questions table
* questionid
* gameid
* questiontext

answers table
* answerid
* questionid
* userid
* rating (as an int?)

Then to find all questions for a game, you select from questions on gameid. To find all answers for a question, you select from answers on questionid. To find out if a user has submitted any particular answer, you select from answers on answerid and userid, and either check if the result set is empty or not, or you COUNT() the selection and check if it is 0 or not (the first is probably faster if there is no result, and the second is probably faster if there is).

If we want questions to be global with the possibility of changing them all at once for all games (which is what I think you mean by "dynamic"), then we just move gameid from the questions table to the answers table, and we have two more operations...inserting into and deleting from the questions table. Inserting would just insert a new question (for which there would be no answers yet). Deleting would be two operations: delete from questions on questionid, and delete from answers on questionid.

Is this not what you meant?

Yeah pretty much. That's pretty much what I'd been playing with too. The voting_api that was mentioned in the mailing list actually covers this pretty well. We'll need something to connect the node(game) to the questions still I think but yeah. I hope to have something to work with by Thurs for the meeting but we'll see. Have to do some repairs to the Lady's car.