mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-14835 - Grade not checked against valid range when manua grading
This commit is contained in:
parent
9c22b42ef7
commit
994c8c3509
5 changed files with 71 additions and 22 deletions
|
@ -61,19 +61,23 @@
|
|||
|
||||
if ($data = data_submitted() and confirm_sesskey()) {
|
||||
// the following will update the state and attempt
|
||||
question_process_comment($question, $state, $attempt, $data->response['comment'], $data->response['grade']);
|
||||
// If the state has changed save it and update the quiz grade
|
||||
if ($state->changed) {
|
||||
save_question_session($question, $state);
|
||||
quiz_save_best_grade($quiz, $attempt->userid);
|
||||
$error = question_process_comment($question, $state, $attempt, $data->response['comment'], $data->response['grade']);
|
||||
if (is_string($error)) {
|
||||
notify($error);
|
||||
} else {
|
||||
// If the state has changed save it and update the quiz grade
|
||||
if ($state->changed) {
|
||||
save_question_session($question, $state);
|
||||
quiz_save_best_grade($quiz, $attempt->userid);
|
||||
}
|
||||
|
||||
notify(get_string('changessaved'));
|
||||
echo '<div class="boxaligncenter"><input type="button" onclick="window.opener.location.reload(1); self.close();return false;" value="' .
|
||||
get_string('closewindow') . "\" /></div>";
|
||||
|
||||
print_footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
notify(get_string('changessaved'));
|
||||
echo '<div class="boxaligncenter"><input type="button" onclick="window.opener.location.reload(1); self.close();return false;" value="' .
|
||||
get_string('closewindow') . "\" /></div>";
|
||||
|
||||
print_footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
question_print_comment_box($question, $state, $attempt, $CFG->wwwroot.'/mod/quiz/comment.php');
|
||||
|
|
|
@ -70,6 +70,7 @@ class quiz_report extends quiz_default_report {
|
|||
confirm_sesskey();
|
||||
|
||||
// now go through all of the responses and save them.
|
||||
$allok = true;
|
||||
foreach($data->manualgrades as $uniqueid => $response) {
|
||||
// get our attempt
|
||||
if (! $attempt = get_record('quiz_attempts', 'uniqueid', $uniqueid)) {
|
||||
|
@ -83,15 +84,22 @@ class quiz_report extends quiz_default_report {
|
|||
$state = &$states[$question->id];
|
||||
|
||||
// the following will update the state and attempt
|
||||
question_process_comment($question, $state, $attempt, $response['comment'], $response['grade']);
|
||||
|
||||
// If the state has changed save it and update the quiz grade
|
||||
if ($state->changed) {
|
||||
$error = question_process_comment($question, $state, $attempt, $response['comment'], $response['grade']);
|
||||
if (is_string($error)) {
|
||||
notify($error);
|
||||
$allok = false;
|
||||
} else if ($state->changed) {
|
||||
// If the state has changed save it and update the quiz grade
|
||||
save_question_session($question, $state);
|
||||
quiz_save_best_grade($quiz, $attempt->userid);
|
||||
}
|
||||
}
|
||||
notify(get_string('changessaved', 'quiz'), 'notifysuccess');
|
||||
|
||||
if ($allok) {
|
||||
notify(get_string('changessaved', 'quiz'), 'notifysuccess');
|
||||
} else {
|
||||
notify(get_string('changessavedwitherrors', 'quiz'), 'notifysuccess');
|
||||
}
|
||||
}
|
||||
|
||||
// our 3 different views
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue