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

Import succeeds unintentionally if csv file contains id which has number and string mixed

    XMLWordPrintable

    Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide
      1. Login as Admin.
      2. Create a Course.
      3. Enrol several Students in the Course
      4. Create a .csv file with the following content:
        (NOTE: make sure the first character of the user id values in this file correspond to the user ids of the enrolled users, otherwise modify these values and add the proper user ids)

       userid,grade
       1A100, 80
       2B200, 75

      1. Go to the course "Grades" page
        1. Click on the "Import tab"
        2. The "CSV file" tab should be active, if not click on it
        3. In the "CSV file" import page
          • Upload the created .csv file in the "File" field.
          • Set "Separator" = "Comma"
          • Click "Upload grades"
        4. In the "Import preview" page
          1. In the "Identify user by" section set:
            • "Map from" = "userid"
            • "Map to" = "User ID"
          2. Press "Upload grades"
      2. Confirm that the import has failed and an error is displayed stating that the user with id of "1A100" (example) could not be found.
      Show
      Login as Admin. Create a Course. Enrol several Students in the Course Create a .csv file with the following content: (NOTE: make sure the first character of the user id values in this file correspond to the user ids of the enrolled users, otherwise modify these values and add the proper user ids) userid,grade 1A100, 80 2B200, 75 Go to the course "Grades" page Click on the "Import tab" The "CSV file" tab should be active, if not click on it In the "CSV file" import page Upload the created .csv file in the "File" field. Set "Separator" = "Comma" Click "Upload grades" In the "Import preview" page In the "Identify user by" section set: "Map from" = "userid" "Map to" = "User ID" Press "Upload grades" Confirm that the import has failed and an error is displayed stating that the user with id of "1A100" (example) could not be found.
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_35_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • Fixed Branches:
      MOODLE_310_STABLE, MOODLE_39_STABLE
    • Pull 3.9 Branch:
      MOODLE_39_STABLE_fix_gradeimport_csv
    • Pull 3.10 Branch:
      MOODLE_310_STABLE_fix_gradeimport_csv
    • Pull 3.11 Branch:
      MOODLE_311_STABLE_fix_gradeimport_csv
    • Pull Master Branch:
      master_fix_gradeimport_csv

      Description

      Hi,
      In MariaDB and latest 3.9.1 code I found a problem.

      When I import grade from /grade/import/csv/index.php, and select not 'ID number' but 'User ID', if csv file has id like '1A100' or '4B200', program unintentionally passes with no error and outputs message 'Grade import success'.

      Behind the scene, for the above example, user id 1 and 4 is selected and set studentid the value.

      I can write a patch to fix this in Moodle fashion.

        Attachments

          Activity

            People

            Assignee:
            intrajp Shintaro Fujiwara
            Reporter:
            intrajp Shintaro Fujiwara
            Peer reviewer:
            Mihail Geshoski Mihail Geshoski
            Integrator:
            Víctor Déniz Falcón Víctor Déniz Falcón
            Tester:
            Gladys Basiana Gladys Basiana
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              10/May/21

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 46 minutes
                3h 46m