miniscule change: subquestion code only has to be unique within question

This commit is contained in:
gustav_delius 2006-03-19 10:43:12 +00:00
parent 549880a59d
commit 18bd0d680c

View file

@ -55,7 +55,7 @@ class question_match_qtype extends quiz_default_questiontype {
unset($subquestion); unset($subquestion);
// Determine a unique random code // Determine a unique random code
$subquestion->code = rand(1,999999999); $subquestion->code = rand(1,999999999);
while (record_exists('question_match_sub', 'code', $subquestion->code)) { while (record_exists('question_match_sub', 'code', $subquestion->code, 'question', $question->id)) {
$subquestion->code = rand(); $subquestion->code = rand();
} }
$subquestion->question = $question->id; $subquestion->question = $question->id;