mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-20636 Fix for Bug 11593 merged from our 1.9 version. #268
This commit is contained in:
parent
9f622ce7d8
commit
6d03fd9830
@ -168,7 +168,7 @@ foreach ($quizzes as $quiz) {
|
|||||||
$grade = '';
|
$grade = '';
|
||||||
$feedback = '';
|
$feedback = '';
|
||||||
if ($quiz->grade && array_key_exists($quiz->id, grades)) {
|
if ($quiz->grade && array_key_exists($quiz->id, grades)) {
|
||||||
if ($alloptions->marks) {
|
if ($alloptions->marks >= question_display_options::MARK_AND_MAX) {
|
||||||
$a = new stdClass();
|
$a = new stdClass();
|
||||||
$a->grade = quiz_format_grade($quiz, $grades[$quiz->id]);
|
$a->grade = quiz_format_grade($quiz, $grades[$quiz->id]);
|
||||||
$a->maxgrade = quiz_format_grade($quiz, $quiz->grade);
|
$a->maxgrade = quiz_format_grade($quiz, $quiz->grade);
|
||||||
|
@ -606,10 +606,12 @@ function quiz_grade_item_update($quiz, $grades = NULL) {
|
|||||||
mod_quiz_display_options::LATER_WHILE_OPEN);
|
mod_quiz_display_options::LATER_WHILE_OPEN);
|
||||||
$closedreviewoptions = mod_quiz_display_options::make_from_quiz($quiz,
|
$closedreviewoptions = mod_quiz_display_options::make_from_quiz($quiz,
|
||||||
mod_quiz_display_options::AFTER_CLOSE);
|
mod_quiz_display_options::AFTER_CLOSE);
|
||||||
if (!$openreviewoptions->marks && !$closedreviewoptions->marks) {
|
if ($openreviewoptions->marks < question_display_options::MARK_AND_MAX &&
|
||||||
|
$closedreviewoptions->marks < question_display_options::MARK_AND_MAX) {
|
||||||
$params['hidden'] = 1;
|
$params['hidden'] = 1;
|
||||||
|
|
||||||
} else if (!$openreviewoptions->marks && $closedreviewoptions->marks) {
|
} else if ($openreviewoptions->marks < question_display_options::MARK_AND_MAX &&
|
||||||
|
$closedreviewoptions->marks >= question_display_options::MARK_AND_MAX) {
|
||||||
if ($quiz->timeclose) {
|
if ($quiz->timeclose) {
|
||||||
$params['hidden'] = $quiz->timeclose;
|
$params['hidden'] = $quiz->timeclose;
|
||||||
} else {
|
} else {
|
||||||
@ -810,7 +812,7 @@ function quiz_get_recent_mod_activity(&$activities, &$index, $timestart,
|
|||||||
|
|
||||||
$tmpactivity->content->attemptid = $attempt->id;
|
$tmpactivity->content->attemptid = $attempt->id;
|
||||||
$tmpactivity->content->attempt = $attempt->attempt;
|
$tmpactivity->content->attempt = $attempt->attempt;
|
||||||
if (quiz_has_grades($quiz) && $options->marks) {
|
if (quiz_has_grades($quiz) && $options->marks >= question_display_options::MARK_AND_MAX) {
|
||||||
$tmpactivity->content->sumgrades = quiz_format_grade($quiz, $attempt->sumgrades);
|
$tmpactivity->content->sumgrades = quiz_format_grade($quiz, $attempt->sumgrades);
|
||||||
$tmpactivity->content->maxgrade = quiz_format_grade($quiz, $quiz->sumgrades);
|
$tmpactivity->content->maxgrade = quiz_format_grade($quiz, $quiz->sumgrades);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1043,13 +1043,16 @@ function quiz_get_review_options($quiz, $attempt, $context) {
|
|||||||
* for all attempts.
|
* for all attempts.
|
||||||
*/
|
*/
|
||||||
function quiz_get_combined_reviewoptions($quiz, $attempts) {
|
function quiz_get_combined_reviewoptions($quiz, $attempts) {
|
||||||
$fields = array('marks', 'feedback', 'generalfeedback', 'rightanswer', 'overallfeedback');
|
$fields = array('feedback', 'generalfeedback', 'rightanswer', 'overallfeedback');
|
||||||
$someoptions = new stdClass();
|
$someoptions = new stdClass();
|
||||||
$alloptions = new stdClass();
|
$alloptions = new stdClass();
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
$someoptions->$field = false;
|
$someoptions->$field = false;
|
||||||
$alloptions->$field = true;
|
$alloptions->$field = true;
|
||||||
}
|
}
|
||||||
|
$someoptions->marks = question_display_options::HIDDEN;
|
||||||
|
$alloptions->marks = question_display_options::MARK_AND_MAX;
|
||||||
|
|
||||||
foreach ($attempts as $attempt) {
|
foreach ($attempts as $attempt) {
|
||||||
$attemptoptions = mod_quiz_display_options::make_from_quiz($quiz,
|
$attemptoptions = mod_quiz_display_options::make_from_quiz($quiz,
|
||||||
quiz_attempt_state($quiz, $attempt));
|
quiz_attempt_state($quiz, $attempt));
|
||||||
@ -1057,6 +1060,8 @@ function quiz_get_combined_reviewoptions($quiz, $attempts) {
|
|||||||
$someoptions->$field = $someoptions->$field || $attemptoptions->$field;
|
$someoptions->$field = $someoptions->$field || $attemptoptions->$field;
|
||||||
$alloptions->$field = $alloptions->$field && $attemptoptions->$field;
|
$alloptions->$field = $alloptions->$field && $attemptoptions->$field;
|
||||||
}
|
}
|
||||||
|
$someoptions->marks = max($someoptions->marks, $attemptoptions->marks);
|
||||||
|
$alloptions->marks = min($alloptions->marks, $attemptoptions->marks);
|
||||||
}
|
}
|
||||||
return array($someoptions, $alloptions);
|
return array($someoptions, $alloptions);
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,8 @@ abstract class quiz_attempt_report extends quiz_default_report {
|
|||||||
}
|
}
|
||||||
$reviewoptions = mod_quiz_display_options::make_from_quiz($quiz, $when);
|
$reviewoptions = mod_quiz_display_options::make_from_quiz($quiz, $when);
|
||||||
|
|
||||||
$this->showgrades = quiz_has_grades($quiz) && ($reviewoptions->marks ||
|
$this->showgrades = quiz_has_grades($quiz) &&
|
||||||
|
($reviewoptions->marks >= question_display_options::MARK_AND_MAX ||
|
||||||
has_capability('moodle/grade:viewhidden', $this->context));
|
has_capability('moodle/grade:viewhidden', $this->context));
|
||||||
|
|
||||||
return $this->showgrades;
|
return $this->showgrades;
|
||||||
|
@ -176,7 +176,7 @@ if ($page == 0) {
|
|||||||
|
|
||||||
// Show marks (if the user is allowed to see marks at the moment).
|
// Show marks (if the user is allowed to see marks at the moment).
|
||||||
$grade = quiz_rescale_grade($attempt->sumgrades, $quiz, false);
|
$grade = quiz_rescale_grade($attempt->sumgrades, $quiz, false);
|
||||||
if ($options->marks && quiz_has_grades($quiz)) {
|
if ($options->marks >= question_display_options::MARK_AND_MAX && quiz_has_grades($quiz)) {
|
||||||
|
|
||||||
if (!$attempt->timefinish) {
|
if (!$attempt->timefinish) {
|
||||||
$rows[] = '<tr><th scope="row" class="cell">' . get_string('grade') . '</th><td class="cell">' .
|
$rows[] = '<tr><th scope="row" class="cell">' . get_string('grade') . '</th><td class="cell">' .
|
||||||
|
@ -102,7 +102,7 @@ $table->attributes['class'] = 'generaltable quizsummaryofattempt boxaligncenter'
|
|||||||
$table->head = array(get_string('question', 'quiz'), get_string('status', 'quiz'));
|
$table->head = array(get_string('question', 'quiz'), get_string('status', 'quiz'));
|
||||||
$table->align = array('left', 'left');
|
$table->align = array('left', 'left');
|
||||||
$table->size = array('', '');
|
$table->size = array('', '');
|
||||||
$markscolumn = $displayoptions->marks;
|
$markscolumn = $displayoptions->marks >= question_display_options::MARK_AND_MAX;
|
||||||
if ($markscolumn) {
|
if ($markscolumn) {
|
||||||
$table->head[] = get_string('marks', 'quiz');
|
$table->head[] = get_string('marks', 'quiz');
|
||||||
$table->align[] = 'left';
|
$table->align[] = 'left';
|
||||||
|
@ -170,9 +170,9 @@ if ($attempts) {
|
|||||||
|
|
||||||
$attemptcolumn = $quiz->attempts != 1;
|
$attemptcolumn = $quiz->attempts != 1;
|
||||||
|
|
||||||
$gradecolumn = $someoptions->marks && quiz_has_grades($quiz);
|
$gradecolumn = $someoptions->marks >= question_display_options::MARK_AND_MAX && quiz_has_grades($quiz);
|
||||||
$markcolumn = $gradecolumn && ($quiz->grade != $quiz->sumgrades);
|
$markcolumn = $gradecolumn && ($quiz->grade != $quiz->sumgrades);
|
||||||
$overallstats = $alloptions->marks;
|
$overallstats = $alloptions->marks >= question_display_options::MARK_AND_MAX;
|
||||||
|
|
||||||
$feedbackcolumn = quiz_has_feedback($quiz) && $alloptions->overallfeedback;
|
$feedbackcolumn = quiz_has_feedback($quiz) && $alloptions->overallfeedback;
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ if ($attempts) {
|
|||||||
$row[] = $datecompleted;
|
$row[] = $datecompleted;
|
||||||
|
|
||||||
if ($markcolumn && $attempt->timefinish > 0) {
|
if ($markcolumn && $attempt->timefinish > 0) {
|
||||||
if ($attemptoptions->marks) {
|
if ($attemptoptions->marks >= question_display_options::MARK_AND_MAX) {
|
||||||
$row[] = quiz_format_grade($quiz, $attempt->sumgrades);
|
$row[] = quiz_format_grade($quiz, $attempt->sumgrades);
|
||||||
} else {
|
} else {
|
||||||
$row[] = '';
|
$row[] = '';
|
||||||
@ -259,7 +259,7 @@ if ($attempts) {
|
|||||||
$attemptgrade = quiz_rescale_grade($attempt->sumgrades, $quiz, false);
|
$attemptgrade = quiz_rescale_grade($attempt->sumgrades, $quiz, false);
|
||||||
|
|
||||||
if ($gradecolumn) {
|
if ($gradecolumn) {
|
||||||
if ($attemptoptions->marks && $attempt->timefinish > 0) {
|
if ($attemptoptions->marks >= question_display_options::MARK_AND_MAX && $attempt->timefinish > 0) {
|
||||||
$formattedgrade = quiz_format_grade($quiz, $attemptgrade);
|
$formattedgrade = quiz_format_grade($quiz, $attemptgrade);
|
||||||
// highlight the highest grade if appropriate
|
// highlight the highest grade if appropriate
|
||||||
if ($overallstats && !$attempt->preview && $numattempts > 1 && !is_null($mygrade) &&
|
if ($overallstats && !$attempt->preview && $numattempts > 1 && !is_null($mygrade) &&
|
||||||
|
@ -53,7 +53,8 @@ class qbehaviour_adaptive_renderer extends qbehaviour_renderer {
|
|||||||
// Try to find the last graded step.
|
// Try to find the last graded step.
|
||||||
|
|
||||||
$gradedstep = $this->get_graded_step($qa);
|
$gradedstep = $this->get_graded_step($qa);
|
||||||
if (is_null($gradedstep) || $qa->get_max_mark() == 0 || !$options->marks) {
|
if (is_null($gradedstep) || $qa->get_max_mark() == 0 ||
|
||||||
|
$options->marks < question_display_options::MARK_AND_MAX) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class qbehaviour_deferredcbm_renderer extends qbehaviour_renderer {
|
|||||||
question_cbm::get_string($qa->get_last_behaviour_var('_assumedcertainty'))));
|
question_cbm::get_string($qa->get_last_behaviour_var('_assumedcertainty'))));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($options->marks) {
|
if ($options->marks >= question_display_options::MARK_AND_MAX) {
|
||||||
$a->rawmark = format_float(
|
$a->rawmark = format_float(
|
||||||
$qa->get_last_behaviour_var('_rawfraction') * $qa->get_max_mark(), $options->markdp);
|
$qa->get_last_behaviour_var('_rawfraction') * $qa->get_max_mark(), $options->markdp);
|
||||||
$a->mark = $qa->format_mark($options->markdp);
|
$a->mark = $qa->format_mark($options->markdp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user