Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-60658

Error when trying to change "grade to pass" to float value with comma

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      1. Switch to language where float numbers has comma as a decimal separator, like this: 11,5
      2. Open any course
      3. Add an assignment
      4. Fill in required fields (leave maximum possible grade = 100)
      5. Set "grade to pass" to float value (ex. 99,75)
      6. Under another user, submit an answer to the assignment
      7. Add grade to the answer
      8. Open assignment settings
      9. Try to save (as they are, with 99,75)
      10. CONFIRM: settings saved (otherwise fails with "The grade to pass can not be greater than the maximum possible grade 100")

      Show
      1. Switch to language where float numbers has comma as a decimal separator, like this: 11,5 2. Open any course 3. Add an assignment 4. Fill in required fields (leave maximum possible grade = 100) 5. Set "grade to pass" to float value (ex. 99,75) 6. Under another user, submit an answer to the assignment 7. Add grade to the answer 8. Open assignment settings 9. Try to save (as they are, with 99,75) 10. CONFIRM: settings saved (otherwise fails with "The grade to pass can not be greater than the maximum possible grade 100")
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Pull Master Branch:
      master

      Description

      In moodle course activity, when trying to change "grade to pass" to some float value with comma (localization standard, ex. 90,5) it shows error:

      "The grade to pass can not be greater than the maximum possible grade ..."

      This happens because of the missing unformat_float in the moodleform_mod.php

      --- moodleform_mod.php.bak  2017-10-23 11:55:34.222730195 +0700
      +++ moodleform_mod.php      2017-10-23 11:46:27.092834648 +0700
      @@ -408,7 +408,7 @@
                   } else {
                       $grade = $scale;
                   }   
      -            if ($data['gradepass'] > $grade) {
      +            if (unformat_float($data['gradepass']) > $grade) {
                       $errors['gradepass'] = get_string('gradepassgreaterthangrade', 'grades', $grade);             }
               }
      

       

      Not sure, if error persists in lower versions.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                19/Mar/18