Revert "MDL-32249 completion: Round course grades and remove hardcoded string"
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Fri, 27 Apr 2012 10:03:26 +0000 (12:03 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Fri, 27 Apr 2012 10:03:26 +0000 (12:03 +0200)
lang/en/completion.php
lib/completion/completion_criteria_grade.php

index 689390e..e737dbf 100644 (file)
@@ -118,7 +118,6 @@ $string['datepassed']='Date passed';
 $string['daysafterenrolment']='Days after enrolment';
 $string['durationafterenrolment']='Duration after enrolment';
 $string['fraction']='Fraction';
-$string['gradetopass']='{$a} to pass';
 $string['inprogress']='In progress';
 $string['manualcompletionby']='Manual completion by';
 $string['manualselfcompletion']='Manual self completion';
index ef195a2..e452454 100644 (file)
@@ -156,14 +156,14 @@ class completion_criteria_grade extends completion_criteria {
      * @return string
      */
     public function get_status($completion) {
-        $grade = $this->get_grade($completion);
-        $gradepass = round($this->gradepass, 2).'%';
+        // Cast as floats to get rid of excess decimal places
+        $grade = (float) $this->get_grade($completion);
+        $gradepass = (float) $this->gradepass;
 
         if ($grade) {
-            $grade = round($grade, 2);
-            return $grade.'% ('.get_string('gradetopass', 'completion', $gradepass).')';
+            return $grade.'% ('.$gradepass.'% to pass)';
         } else {
-            return get_string('gradetopass', 'completion', $gradetopass);
+            return $gradepass.'% to pass';
         }
     }
 
@@ -232,10 +232,10 @@ class completion_criteria_grade extends completion_criteria {
         $details = array();
         $details['type'] = get_string('coursegrade', 'completion');
         $details['criteria'] = get_string('passinggrade', 'completion');
-        $details['requirement'] = round($this->gradepass, 2).'%';
+        $details['requirement'] = ((float)$this->gradepass).'%';
         $details['status'] = '';
 
-        $grade = round($this->get_grade($completion), 2);
+        $grade = (float)$this->get_grade($completion);
         if ($grade) {
             $details['status'] = $grade.'%';
         }