Last post Jan 27, 2015 04:41 AM by mdehghani
Jan 25, 2015 09:55 PM|mdehghani|LINK
hi everyone.. I'm trying to complete a quiz project in which users log in to the website, see the questions, answer them and finally see the results. so far I have a questions table which stores my questions containing these columns: QuestionId, Text, Choices,
CorrectAnswer,ExamId, ... and an answers table which stores every users answer containing AnswerId, UserId, QuestionId, UserAnswer,ExamId... my final goal is to display the users score and ranking in the results page... for counting the correct, incorrect
and null answers I JOIN the Answers Table on the questions table and compare the users answer to the correct one and use this data to calculate the users score percentage..
now the problem is that I can't find a way to calculate all of the users scores at once and give a specific user its proper ranking among others.. should I design another table for doing this task or can I do it in the same page and with my available tables?
Jan 26, 2015 02:14 AM|ignatandrei|LINK
now the problem is that I can't find a way to calculate all of the users scores at once and give a specific user its proper ranking among others.. should I design another table for doing this task
For performance reasons it is better this way
Jan 26, 2015 03:59 AM|mdehghani|LINK
then how should I provide the new table with data from the previous tables? I have not done such practice before..
Jan 26, 2015 09:21 AM|ignatandrei|LINK
how should I provide the new table with data from the previous tables?
When the user saves all the answers for the quiz, call a Stored procedure that does this task. Or calculate in C#.
Jan 26, 2015 07:58 PM|mdehghani|LINK
thanks but stored procedures are not apparently supported in webmatrix (sql CE). what do you mean by calculating in C#?
Jan 26, 2015 09:58 PM|Edwin Guru Singh|LINK
As per your case , I have been shared my suggestion below :
1. Better you have to keep three tables as Question table, Answer table & UserAnswered table.
2. If you are using RAZOR in your webpage, then you can calculate the expected result from webmatrix sdf.
For your reference ,check this link :
Jan 27, 2015 04:41 AM|mdehghani|LINK
Dear Edwin Guru Singh,
Thanks for your advice, but the resources you have offered are so fundamental.. If I have not known the basics I couldn't have come this far..