]> git.mjollnir.org Git - moodle.git/commitdiff
quiz and qtypes: Regressions from MDL-7308 since '0.0000000' is not empty() in PHP.
authortjhunt <tjhunt>
Wed, 11 Mar 2009 06:36:25 +0000 (06:36 +0000)
committertjhunt <tjhunt>
Wed, 11 Mar 2009 06:36:25 +0000 (06:36 +0000)
mod/quiz/report/responses/responses_table.php
question/type/questiontype.php
question/type/shortanswer/questiontype.php

index 640a6a9155a912e00261da77b8e3d8985d793c2e..e2eaf521099ea720a065ad1e47b7cc5711852088 100644 (file)
@@ -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 '-';
index 23e33de9e129d70e1c585c14115b1e4f92647931..ed801bd9f01640b1be8938e0cdaef3af677de39d 100644 (file)
@@ -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;
index 6e125c194e98aedba1dc410699136cf8afd26fdc..15d616add44efa86039e887981bbad732bc4556d 100644 (file)
@@ -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;