Open ragaeeb opened 9 years ago
Possible solution:
database has N = 20 questions total. there are S = 19 standard multiple choice questions available. there are B = 4 bool questions available. there are O = 2 ordered questions available. we want to display a total of X = 10 questions for the session. [may need to be adjusted with N]
we want total standard multiple choice to be: X*( rand(0.7,0.8) ) = 7
3 remaining.
we want total bool questions to be (10%): Y*( rand(0.1,0.1) )...
1 remaining, rest of them will be ordered questions.
a21b6cbb90ed52781dea46ad79ad6541fdb4808c
Assume there are only 2 ordered questions in the entire database [id = 3,4].
Currently the logic for picking questions is:
if (x == 5) then fetch an ordered question.
y = ordered_question_id = 4;
user gets question right.
x = random # between 1 and 10 = 5; fetch an ordered question where question_id NOT IN [4] y = ordered_question_id= 3;
user gets question right.
x = random # between 1 and 10 = 5; fetch an ordered question where question_id NOT IN [3,4] no questions found.
x = random # between 1 and 10 = 5; fetch an ordered question where question_id NOT IN [3,4] no questions found. ...
infinite loop