diff --git a/mod/quiz/report/responses/responses_table.php b/mod/quiz/report/responses/responses_table.php index 640a6a9155a..e2eaf521099 100644 --- a/mod/quiz/report/responses/responses_table.php +++ b/mod/quiz/report/responses/responses_table.php @@ -168,7 +168,7 @@ class quiz_report_responses_table extends table_sql { 'reviewquestion', $summary, 450, 650, get_string('reviewresponse', 'quiz'), 'none', true); if (question_state_is_graded($stateforqinattempt) - && ($question->maxgrade != 0)){ + && ($question->maxgrade > 0)){ $grade = $stateforqinattempt->grade / $question->maxgrade; $qclass = question_get_feedback_class($grade); @@ -193,9 +193,9 @@ class quiz_report_responses_table extends table_sql { function col_feedbacktext($attempt){ if ($attempt->timefinish) { if (!$this->is_downloading()) { - return quiz_report_feedback_for_grade(quiz_rescale_grade($attempt->sumgrades, $this->quiz), $this->quiz->id); + return quiz_report_feedback_for_grade(quiz_rescale_grade($attempt->sumgrades, $this->quiz, false), $this->quiz->id); } else { - return strip_tags(quiz_report_feedback_for_grade(quiz_rescale_grade($attempt->sumgrades, $this->quiz), $this->quiz->id)); + return strip_tags(quiz_report_feedback_for_grade(quiz_rescale_grade($attempt->sumgrades, $this->quiz, false), $this->quiz->id)); } } else { return '-'; diff --git a/question/type/questiontype.php b/question/type/questiontype.php index 23e33de9e12..ed801bd9f01 100644 --- a/question/type/questiontype.php +++ b/question/type/questiontype.php @@ -777,10 +777,9 @@ class default_questiontype { // ULPGC ecastro function get_fractional_grade(&$question, &$state) { - $maxgrade = $question->maxgrade; $grade = $state->grade; - if ($maxgrade) { - return (float)($grade/$maxgrade); + if ($question->maxgrade > 0) { + return (float)($grade / $question->maxgrade); } else { return (float)$grade; } @@ -908,7 +907,7 @@ class default_questiontype { } $grade = ''; - if ($question->maxgrade and $options->scores) { + if ($question->maxgrade > 0 && $options->scores) { if ($cmoptions->optionflags & QUESTION_ADAPTIVE) { if ($isgraded) { $grade = question_format_grade($cmoptions, $state->last_graded->grade).'/'; @@ -1148,7 +1147,7 @@ class default_questiontype { echo ' '; print_string('duplicateresponse', 'quiz'); } - if (!empty($question->maxgrade) && $options->scores) { + if ($question->maxgrade > 0 && $options->scores) { if (question_state_is_graded($state->last_graded)) { // Display the grading details from the last graded state $grade = new stdClass; diff --git a/question/type/shortanswer/questiontype.php b/question/type/shortanswer/questiontype.php index 6e125c194e9..15d616add44 100644 --- a/question/type/shortanswer/questiontype.php +++ b/question/type/shortanswer/questiontype.php @@ -309,7 +309,7 @@ class question_shortanswer_qtype extends default_questiontype { echo ' '; print_string('duplicateresponse', 'quiz'); } - if (!empty($question->maxgrade) && $options->scores) { + if ($question->maxgrade > 0 && $options->scores) { if (question_state_is_graded($state->last_graded)) { // Display the grading details from the last graded state $grade = new stdClass;