Permalink
Browse files

Merge branch 'MDL-32249c-21' of github.com:srynot4sale/moodle into MO…

…ODLE_21_STABLE
  • Loading branch information...
2 parents c27a493 + 676910a commit 555769489a8de49d776ed8e45b05ab59f3a14817 @stronk7 stronk7 committed Jul 1, 2012
Showing with 21 additions and 23 deletions.
  1. +0 −10 course/completion.php
  2. +4 −1 course/completion_form.php
  3. +3 −1 lang/en/completion.php
  4. +14 −11 lib/completion/completion_criteria_grade.php
View
@@ -141,16 +141,6 @@
$aggregation->setMethod($data->role_aggregation);
$aggregation->save();
- // Update course total passing grade
- if (!empty($data->criteria_grade)) {
- if ($grade_item = grade_category::fetch_course_category($course->id)->grade_item) {
- $grade_item->gradepass = $data->criteria_grade_value;
- if (method_exists($grade_item, 'update')) {
- $grade_item->update('course/completion.php');
- }
- }
- }
-
add_to_log($course->id, 'course', 'completion updated', 'completion.php?id='.$course->id);
$url = new moodle_url('/course/view.php', array('id' => $course->id));
@@ -179,10 +179,13 @@ function definition() {
$criteria->config_form_display($mform);
// Completion on course grade
- $mform->addElement('header', 'grade', get_string('grade'));
+ $mform->addElement('header', 'grade', get_string('coursegrade', 'completion'));
// Grade enable and passing grade
$course_grade = $DB->get_field('grade_items', 'gradepass', array('courseid' => $course->id, 'itemtype' => 'course'));
+ if (!$course_grade) {
+ $course_grade = '0.00000';
+ }
$criteria = new completion_criteria_grade($params);
$criteria->config_form_display($mform, $course_grade);
@@ -109,6 +109,7 @@
$string['coursesavailable']='Courses available';
$string['coursesavailableexplaination']='<i>Course completion criteria must be set for a course to appear in this list</i>';
$string['criteria']='Criteria';
+$string['criteriagradenote'] = 'Please note that updating the required grade here will not update the current course pass grade.';
$string['criteriagroup']='Criteria group';
$string['criteriarequiredall']='All criteria below are required';
$string['criteriarequiredany']='Any criteria below are required';
@@ -123,6 +124,8 @@
$string['daysafterenrolment']='Days after enrolment';
$string['durationafterenrolment']='Duration after enrolment';
$string['fraction']='Fraction';
+$string['gradexrequired']='{$a} required';
+$string['graderequired']='Grade required';
$string['inprogress']='In progress';
$string['manualcompletionby']='Manual completion by';
$string['manualselfcompletion']='Manual self completion';
@@ -135,7 +138,6 @@
$string['notenroled']='You are not enrolled in this course';
$string['notyetstarted']='Not yet started';
$string['overallcriteriaaggregation']='Overall criteria type aggregation';
-$string['passinggrade']='Passing grade';
$string['pending']='Pending';
$string['periodpostenrolment']='Period post enrolment';
$string['prerequisites']='Prerequisites';
@@ -58,8 +58,9 @@ public static function fetch($params) {
*/
public function config_form_display(&$mform, $data = null) {
$mform->addElement('checkbox', 'criteria_grade', get_string('enable'));
- $mform->addElement('text', 'criteria_grade_value', get_string('passinggrade', 'completion'));
+ $mform->addElement('text', 'criteria_grade_value', get_string('graderequired', 'completion'));
$mform->setDefault('criteria_grade_value', $data);
+ $mform->addElement('static', 'criteria_grade_value_note', '', get_string('criteriagradenote', 'completion'));
if ($this->id) {
$mform->setDefault('criteria_grade', 1);
@@ -126,7 +127,7 @@ public function review($completion, $mark = true) {
* @return string
*/
public function get_title() {
- return get_string('grade');
+ return get_string('coursegrade', 'completion');
}
/**
@@ -135,7 +136,8 @@ public function get_title() {
* @return string
*/
public function get_title_detailed() {
- return (float) $this->gradepass . '% required';
+ $graderequired = round($this->gradepass, 2).'%';
+ return get_string('gradexrequired', 'completion', $graderequired);
}
/**
@@ -154,15 +156,16 @@ public function get_type_title() {
* @return string
*/
public function get_status($completion) {
- // Cast as floats to get rid of excess decimal places
- $grade = (float) $this->get_grade($completion);
- $gradepass = (float) $this->gradepass;
+ $grade = $this->get_grade($completion);
+ $graderequired = $this->get_title_detailed();
if ($grade) {
- return $grade.'% ('.$gradepass.'% to pass)';
+ $grade = round($grade, 2).'%';
} else {
- return $gradepass.'% to pass';
+ $grade = get_string('nograde');
}
+
+ return $grade.' ('.$graderequired.')';
}
/**
@@ -230,11 +233,11 @@ public function cron() {
public function get_details($completion) {
$details = array();
$details['type'] = get_string('coursegrade', 'completion');
- $details['criteria'] = get_string('passinggrade', 'completion');
- $details['requirement'] = ((float)$this->gradepass).'%';
+ $details['criteria'] = get_string('graderequired', 'completion');
+ $details['requirement'] = round($this->gradepass, 2).'%';
$details['status'] = '';
- $grade = (float)$this->get_grade($completion);
+ $grade = round($this->get_grade($completion), 2);
if ($grade) {
$details['status'] = $grade.'%';
}

0 comments on commit 5557694

Please sign in to comment.