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

Importing csv grades should display line number on error

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.0.5, 4.2, 4.5
    • Gradebook
    • MOODLE_400_STABLE, MOODLE_402_STABLE, MOODLE_405_STABLE
    • 76318-gradebook-improve-csv-import-error-message-main
    • Hide

      Covered by PHPUnit tests. For manual test:

      Setup:

      1. Create a user with 123 as ID number (the field is available behind "Optional" section)
      2. Create a course and enrol created user as student
      3. Go to grades tab
      4. Select gradebook setup in the dropdown menu grader report
      5. Click on add grade item button
      6. Define a new grade item of type "value" and with algebra as ID number (the field is behind "show more..." link)

      Test:

      1. Select import in the dropdown menu
      2. Upload and submit the following csv file: sample.csv
      3. Set the mapping with the following values:

        // Identify user by
        - Map from => ID number
        - Map to => ID number
        // Grade item mappings
        - ID number => Ignore
        - algebra => algebra
        

      4. Ensure you have the following error messages:
        • Supplied grade ('A') is invalid on line 2.
        • Import failed. No data was imported.
      Show
      Covered by PHPUnit tests. For manual test: Setup: Create a user with 123 as ID number (the field is available behind " Optional " section) Create a course and enrol created user as student Go to grades tab Select gradebook setup in the dropdown menu grader report Click on add grade item button Define a new grade item of type " value " and with algebra as ID number (the field is behind " show more... " link) Test: Select import in the dropdown menu Upload and submit the following csv file: sample.csv Set the mapping with the following values: // Identify user by - Map from => ID number - Map to => ID number // Grade item mappings - ID number => Ignore - algebra => algebra Ensure you have the following error messages: Supplied grade ('A') is invalid on line 2. Import failed. No data was imported.
    • Hide

      Code verified against automated checks.

      Checked MDL-76318 using repository: https://github.com/DSI-Universite-Rennes2/moodle/

      More information about this report

      Built on: Wed Mar 12 09:56:34 UTC 2025

      Show
      Code verified against automated checks. Checked MDL-76318 using repository: https://github.com/DSI-Universite-Rennes2/moodle/ main (0 errors / 0 warnings) [branch: 76318-gradebook-improve-csv-import-error-message-main | CI Job ] More information about this report Built on: Wed Mar 12 09:56:34 UTC 2025
    • Show
      Launching automatic jobs for branch 76318-gradebook-improve-csv-import-error-message-main https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/18541/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/63500/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/63501/ Behat (Firefox - boost) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/63502/ Behat (Firefox - classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/63503/ App tests (stable app version) Built on: Wed Mar 12 06:25:15 UTC 2025

      When trying to import csv grades with invalid data, the user gets an exception with no error hint.

      It would be great to show at least which line is faulty.

            jboulen Julien Boulen
            jboulen Julien Boulen
            Glyn (Mathew) May Glyn (Mathew) May
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

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

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