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

mod/assign/gradeformat float number formating issue

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      1. Create an assign.
      2. As a student make a submission to it.
      3. Log into the course as a teacher in the submission grade page in the "Grade" part if you enter something like 6,,6 or 6..6 in the "Grade out of 100" ensure that that the grade is not accepted
      4. Put in a correct value like 6.6 and ensure that the grade is accepted
      5. Switch your language to french
      6. Repeat the same test, ensuring 6,6 is accepted

      Show
      1. Create an assign. 2. As a student make a submission to it. 3. Log into the course as a teacher in the submission grade page in the "Grade" part if you enter something like 6,,6 or 6..6 in the "Grade out of 100" ensure that that the grade is not accepted 4. Put in a correct value like 6.6 and ensure that the grade is accepted 5. Switch your language to french 6. Repeat the same test, ensuring 6,6 is accepted
    • Affected Branches:
      MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-49323-master

      Description

      As a teacher (somebody who can grade) when you are in the submission grade page in the "Grade" part if you enter something like 6,,6 in the "Grade out of 100" field the number get processed as 6 instead of getting an error message.

      To get the right behaviour, you must correct the mod/assign/gradeform.php mod_assign_grade_form::validation method changing
      line 92: if (unformat_float($data['grade']) === null && (!empty($data['grade']))) {
      by
      if (!unformat_float($data['grade'], true) && (!empty($data['grade']))) {

      With that change, the validation works as expected.

      https://github.com/nmoller/moodle/tree/MDL-49323

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            nmoller Nelson Moller
            Peer reviewer:
            Dave Cooper
            Integrator:
            Dan Poltawski
            Tester:
            David Monllaó
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              6/Jul/15