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

Grade to pass throws an error when a decimal point separator is used

XMLWordPrintable

    • MOODLE_29_STABLE, MOODLE_30_STABLE
    • MOODLE_29_STABLE
    • MDL-50394_master
    • Hide
      Test 1
      1. Add an activity to a course.
      2. Edit the activity.
      3. In the 'Grade to pass' field enter some invalid values (eg. 'someword', '!@#) - ensure you get an error about using an invalid number.
      4. Enter a valid number and ensure the form saves successfully.
      5. Re-edit the form and set the 'Grade to pass' value to '0' - ensure it saves successfully.
      Test 2
      1. Repeat test 1 using the Swedish language pack (Svenska (sv)). Note - instead of decimal points, commas are used.
      Test 3
      1. Pass MDL-13831 testing instructions.
      Show
      Test 1 Add an activity to a course. Edit the activity. In the 'Grade to pass' field enter some invalid values (eg. 'someword', '!@#) - ensure you get an error about using an invalid number. Enter a valid number and ensure the form saves successfully. Re-edit the form and set the 'Grade to pass' value to '0' - ensure it saves successfully. Test 2 Repeat test 1 using the Swedish language pack (Svenska (sv)). Note - instead of decimal points, commas are used. Test 3 Pass MDL-13831 testing instructions.
    • Team Beards Sprint 7

      This is a regression caused by MDL-13831.

      When a different decimal point separator is specified for the current language, gradepass variable does not respect it and therefore an error is thrown. This happens because it is successfully being formatted according to current language, but it never gets unformatted back. Therefore, it is impossible to edit an activity.

      Line 676 of course/moodleform_mod.php:
      $mform->addRule('gradepass', null, 'numeric', null, 'client');

      This rule always throws an error when another decimal point separator is used.
      If one comments out this rule, then another error is thrown due to inability to save the value to DB, because it is not unformatted back to the float value.

      Therefore either of two options to be implemented:
      1) the value has to be unformatted back before rule is executed
      OR
      2) a) the rule should use format_float function & b) the value has to be unformatted back before saving to DB

            markn Mark Nelson
            pavel.m.sokolov Pavel Sokolov
            Simey Lameze Simey Lameze
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Ankit Agarwal Ankit Agarwal
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.