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

Importing grades from a .txt file with commas for decimals causes an error

XMLWordPrintable

    • MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • MDL-38239-master
    • Hide

      Prerequisites

      1. As a teacher, enter a course with multiples students
      2. Create manual grading element in "Grades"

      Testing instructions

      1. Run the unit tests for the moodlelib_testcase class:

        phpunit moodlelib_testcase lib/tests/moodlelib_test.php
        

      2. Turn the language to one who the decimal separator is different that the one in English (Ex. French using ",").
      3. Export an Excel file (also in French version, with point delimiter set with a comma)
      4. Go to the file and enter many different grades for students:
        1. Put "78.5"
        2. Put "78,5"
        3. Put "100,00" (Be sure Excel do not convert it to "100" if so, edit the text file manually to keep "100,00")
        4. Put "0"
        5. Put "100"
        6. Put "1 00" (Should tested with "1 000" because the space is the thousand separator but the max grade is by default 100)
        7. Put "-12,34" (Should be converted to 0 unless you put the minimum range for the grade under the -12.34)
        8. Put "-12.34" (Should be converted to 0 unless you put the minimum range for the grade under the -12.34)
      5. Save it as a text file (with tabulation as separators)
      6. Import this new file, with Windows-1252 as encoding and tab for separator
      7. Go to the Grader report page
      8. It should all import successfully
      9. Erase all the imported grades
      10. Go to the file, remove all grades and enter this grade for one student:
        1. Enter "Wrong value"
      11. Import this new file, with Windows-1252 as encoding and tab for separator
      12. This should display an error : "Supplied grade is invalid"
      13. Change the language back to English
      14. Go to the file and replace the grade entered by this one:
        1. Put "78,5"
      15. Import this new file, with Windows-1252 as encoding and tab for separator
      16. This should not working by display: "Supplied grade is invalid"
      17. Go to the file and replace the grade entered by this one:
        1. Put "78.5"
      18. Import this new file, with Windows-1252 as encoding and tab for separator
      19. This one should work
      Show
      Prerequisites As a teacher, enter a course with multiples students Create manual grading element in "Grades" Testing instructions Run the unit tests for the moodlelib_testcase class: phpunit moodlelib_testcase lib/tests/moodlelib_test.php Turn the language to one who the decimal separator is different that the one in English (Ex. French using ","). Export an Excel file (also in French version, with point delimiter set with a comma) Go to the file and enter many different grades for students: Put "78.5" Put "78,5" Put "100,00" (Be sure Excel do not convert it to "100" if so, edit the text file manually to keep "100,00") Put "0" Put "100" Put "1 00" (Should tested with "1 000" because the space is the thousand separator but the max grade is by default 100) Put "-12,34" (Should be converted to 0 unless you put the minimum range for the grade under the -12.34) Put "-12.34" (Should be converted to 0 unless you put the minimum range for the grade under the -12.34) Save it as a text file (with tabulation as separators) Import this new file, with Windows-1252 as encoding and tab for separator Go to the Grader report page It should all import successfully Erase all the imported grades Go to the file, remove all grades and enter this grade for one student: Enter "Wrong value" Import this new file, with Windows-1252 as encoding and tab for separator This should display an error : "Supplied grade is invalid" Change the language back to English Go to the file and replace the grade entered by this one: Put "78,5" Import this new file, with Windows-1252 as encoding and tab for separator This should not working by display: "Supplied grade is invalid" Go to the file and replace the grade entered by this one: Put "78.5" Import this new file, with Windows-1252 as encoding and tab for separator This one should work

      When a teacher imports a .txt file with grades, if this one has commas instead of periods for decimals, an error appears: "Supplied grade is invalid".

      To reproduce:

      1. Create manual grading elements in "Grades"
      2. Export an Excel file
      3. Go to the file and enter grades for students
      4. Save it as a .txt (with tabulation as separators)
      5. Import this new file, with Windows-1252 as encoding and tab for separator

      Result: error will appear.

      This has been tested with 2.3.2 and 2.2.x

            leblangi Gilles-Philippe Leblanc
            melrome Melvin Romero
            Adrian Greeve Adrian Greeve
            Dan Poltawski Dan Poltawski
            Andrew Davis Andrew Davis
            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.