-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
3.9.8
-
None
-
2020081901
-
MOODLE_39_STABLE
We got reported that the Hangman game was not respecting the attempt limit when a student finished the game. The problem was that, when a student finished all its attempts it reloaded the page so it gets a brand new attempt.
To correct this problem (just for the Hangman game) we added a this code at the mod/game/attempt.php file, in the game_do_attempt() function and before the if ($continue) statement:
if ($game->gamekind == "hangman") { |
global $USER, $CFG;
|
$unfinishedattempt = game_get_user_attempt_unfinished($game->id, $USER->id);
|
if ((!$unfinishedattempt) && (!game_can_start_new_attempt($game))) { |
$continue = false; |
$redirect_url = $CFG->wwwroot . '/mod/game/view.php?id=' . $cm->id; |
redirect($redirect_url);
|
}
|
}
|
Our current Moodle version is 3.9.4