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

DML exception when setting grade category "hidden until" field

    XMLWordPrintable

Details

    • MOODLE_310_STABLE, MOODLE_311_STABLE
    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • MDL-72377-311
    • MDL-72377-400
    • Hide

      Grade category hidden field

      1. Log in as admin
      2. Create a course
      3. Navigate to course gradebook setup (note version differences)
        • 311: via Grades link in drawer select Setup tab
        • 40/master: via Grades tab select Gradebook setup from tertiary navigation
      4. Edit the default course category (Edit > Edit settings)
      5. In the Category total fieldset, press Show more...
      6. Enable the Hidden until field, select a date in the future
      7. Save changes
      8. Confirm the course category is dimmed in gradebook setup (to indicate "hidden"), and no database exception is present
      9. Edit the settings of the course category again
      10. Confirm the Hidden field is ticked and disabled
      11. In the Category total fieldset, press Show more...
      12. Confirm the Hidden until field displays the same value as previously set
      13. Disable Hidden until
      14. Ensure Hidden is still enabled
      15. Save changes
      16. Confirm the course category is dimmed in gradebook setup (to indicate "hidden")
      17. Edit the settings of the course category again
      18. Confirm the Hidden field is ticked and enabled
      19. In the Category total fieldset, press Show more...
      20. Confirm the Hidden until field is not enabled

      Grade item hidden field

      1. Log in as admin
      2. Navigate to Advanced features in site administration
      3. Tick Enable outcomes and save changes
      4. Create a new user
      5. Navigate to your test course
      6. Enrol new user in the course as a student
      7. Add an assignment activity to the course
      8. Navigate to course gradebook setup
      9. Press Edit grade for new user in the assignment activity
      10. Enable the Hidden until field
      11. Confirm the Hidden field becomes disabled

      Outcome item hidden field

      1. Navigate back to course gradebook setup
      2. Go to Manage outcomes page
        • 311: via Outcomes tab, then Edit outcomes
        • 40/master: via More > Outcomes in tertiary navigation, then Manage outcomes
      3. Press Add new outcome
      4. Fill out form and save
      5. Navigate back to course gradebook setup
      6. Press Add outcome item
      7. Press Show more...
      8. Enable the Hidden until field
      9. Confirm the Hidden field becomes disabled
      Show
      Grade category hidden field Log in as admin Create a course Navigate to course gradebook setup (note version differences) 311: via Grades link in drawer select Setup tab 40/master: via Grades tab select Gradebook setup from tertiary navigation Edit the default course category ( Edit > Edit settings ) In the Category total fieldset, press Show more... Enable the Hidden until field, select a date in the future Save changes Confirm the course category is dimmed in gradebook setup (to indicate "hidden"), and no database exception is present Edit the settings of the course category again Confirm the Hidden field is ticked and disabled In the Category total fieldset, press Show more... Confirm the Hidden until field displays the same value as previously set Disable Hidden until Ensure Hidden is still enabled Save changes Confirm the course category is dimmed in gradebook setup (to indicate "hidden") Edit the settings of the course category again Confirm the Hidden field is ticked and enabled In the Category total fieldset, press Show more... Confirm the Hidden until field is not enabled Grade item hidden field Log in as admin Navigate to Advanced features in site administration Tick Enable outcomes and save changes Create a new user Navigate to your test course Enrol new user in the course as a student Add an assignment activity to the course Navigate to course gradebook setup Press Edit grade for new user in the assignment activity Enable the Hidden until field Confirm the Hidden field becomes disabled Outcome item hidden field Navigate back to course gradebook setup Go to Manage outcomes page 311: via Outcomes tab, then Edit outcomes 40/master: via More > Outcomes in tertiary navigation, then Manage outcomes Press Add new outcome Fill out form and save Navigate back to course gradebook setup Press Add outcome item Press Show more... Enable the Hidden until field Confirm the Hidden field becomes disabled

    Description

      This is a problem because this field can accept timestamps.
       
      Reproduction steps:

      1. Create a course.
      2. Visit the course.
      3. Click on 'Grades' on the left.
      4. Click on the 'Setup' tab.
      5. Edit the category for your course by clicking 'Edit' next to the course name and then 'Edit settings'.
      6. Under 'Category total' click 'Show more...'.
      7. Check the 'Hidden' checkbox.
      8. Set 'Hidden until' to 'Enable'.
      9. Click 'Save changes'.
      10. Re-edit the category.
      11. Under 'Category total' click 'Show more...'.
      12. Notice the 'Hidden until' is disabled.

      So the current problem is the field is just ignored.

      MDL-49202 fixes this so that field is not ignored but then the following error occurs.

      Debug info: ERROR: value "1629360300" is out of range for type smallint
      UPDATE mdl_grade_categories SET courseid = $1,parent = $2,depth = $3,path = $4,fullname = $5,aggregation = $6,keephigh = $7,droplow = $8,aggregateonlygraded = $9,aggregateoutcomes = $10,timecreated = $11,timemodified = $12,hidden = $13 WHERE id=$14
      [array (
      'courseid' => 6,
      'parent' => NULL,
      'depth' => '1',
      'path' => '/5/',
      'fullname' => '?',
      'aggregation' => '13',
      'keephigh' => '0',
      'droplow' => 0,
      'aggregateonlygraded' => '1',
      'aggregateoutcomes' => 0,
      'timecreated' => '1623216974',
      'timemodified' => 1629360308,
      'hidden' => 1629360300,
      0 => 5,
      )]
      Error code: dmlwriteexception
      

       

      Attachments

        Issue Links

          Activity

            People

              pholden Paul Holden
              markn Mark Nelson
              Shamim Rezaie Shamim Rezaie
              Jake Dallimore Jake Dallimore
              Angelia Dela Cruz Angelia Dela Cruz
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, Adrian Greeve, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              3 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                11/Jul/22

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours, 50 minutes
                  4h 50m