Skip to content

Commit

Permalink
Fixed problem in random qtype (incorrect selection of state).
Browse files Browse the repository at this point in the history
Fixed bug 3129. Randomsamatch now reports a propper error if not enogh SA questions are available.
  • Loading branch information
mindforge committed May 17, 2005
1 parent 5a502b7 commit 16d85f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mod/quiz/questiontypes/random/questiontype.php
Expand Up @@ -104,7 +104,7 @@ function create_session_and_responses(&$question, &$state, $quiz, $attempt) {
function restore_session_and_responses(&$question, &$state) {
global $QUIZ_QTYPES;
if(!$randomstate = get_record('quiz_states', 'question',
$question->id)) {
$question->id, 'attempt', $state->attempt)) {
return false;
}

Expand Down
9 changes: 6 additions & 3 deletions mod/quiz/questiontypes/randomsamatch/questiontype.php
Expand Up @@ -82,9 +82,12 @@ function create_session_and_responses(&$question, &$state, $quiz, $attempt) {
$wanted = $question->options->choose;
if ($count < $wanted && isteacherinanycourse()) {
notify("Error: could not get enough Short-Answer questions!
Got $count Short-Answer questions, but wanted $wanted.
Reducing number to choose from to $count!");
$question->options->choose = $count;
This can happen if all available Short-Answer questions are already
taken up by other Random questions or Random Short-Answer question.
Another possible cause for this error is that Short-Answer
questions were deleted after this Random Short-Answer question was
created.");
return false;
}

$saquestions =
Expand Down

0 comments on commit 16d85f5

Please sign in to comment.