Skip to content

Commit

Permalink
Revert "MDL-32249 completion: Round course grades and remove hardcode…
Browse files Browse the repository at this point in the history
…d string"

This reverts commit 412cecc.
  • Loading branch information
stronk7 committed Apr 27, 2012
1 parent 7c0d3f4 commit 291e168
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion lang/en/completion.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
$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';
Expand Down
14 changes: 7 additions & 7 deletions lib/completion/completion_criteria_grade.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ public function get_type_title() {
* @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';
}
}

Expand Down Expand Up @@ -232,10 +232,10 @@ public function get_details($completion) {
$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.'%';
}
Expand Down

0 comments on commit 291e168

Please sign in to comment.