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

mod_assign: grade penalty, division by zero exception

XMLWordPrintable

    • MOODLE_500_STABLE
    • MOODLE_500_STABLE
    • MDL-84998_main
    • Hide

      Enable "Late submission penalty" plugin

      1. Go to "Grades > Grade penalties > Manage penalty plugins* in site administration:
        • Click on 'toggle' button to enable 'Late submission penalties' plugin
      2. Go to "Grades > Grade penalties > Late submission penalties > Penalty rules":
        • Create some penalty rules

      Enable "Grade penalty" for assignment

      1. Go to "Grades > Grade penalties > Supported modules":
        • Click to select "Assignment"
        • Save changes

      Testing: Penalty implementation on an assignment

      1. Create a test course
      2. Create an assignment in the course:
        1. Set due date to "Yesterday" / a date in the past
        2. Submission types: File submissions
        3. Make sure grade type is set to point
        4. Enable "Grade penalties" under "Grade" section
      3. Enrol a student to the course
      4. Login as the student
      5. Add an submission
      6. Log in as an teacher give "0" grade to the submission. Expected behavior:
        1. There is no error when Zero grade is given

       

      Show
      Enable "Late submission penalty" plugin Go to "Grades > Grade penalties > Manage penalty plugins* in site administration: Click on 'toggle' button to enable 'Late submission penalties' plugin Go to "Grades > Grade penalties > Late submission penalties > Penalty rules": Create some penalty rules Enable "Grade penalty" for assignment Go to "Grades > Grade penalties > Supported modules": Click to select "Assignment" Save changes Testing: Penalty implementation on an assignment Create a test course Create an assignment in the course: Set due date to "Yesterday" / a date in the past Submission types: File submissions Make sure grade type is set to point Enable "Grade penalties" under "Grade" section Enrol a student to the course Login as the student Add an submission Log in as an teacher give "0" grade to the submission. Expected behavior: There is no error when Zero grade is given  
    • Hide

      Code verified against automated checks.

      Checked MDL-84998 using repository: https://github.com/catalyst/moodle

      More information about this report

      Built on: Tue Mar 25 23:26:20 UTC 2025

      Show
      Code verified against automated checks. Checked MDL-84998 using repository: https://github.com/catalyst/moodle main (0 errors / 0 warnings) [branch: MDL-84998_main | CI Job ] More information about this report Built on: Tue Mar 25 23:26:20 UTC 2025
    • Show
      Launching automatic jobs for branch MDL-84998 _main https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/18802/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64401/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64402/ Behat (Firefox - boost) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64403/ Behat (Firefox - classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64404/ App tests (stable app version) Built on: Wed Mar 26 06:30:19 UTC 2025

      This error occur when final grade is zero

       

      Step to replicate:

      • Set up penalty rule
      • Create a course
      • Create a assignment
      • Create and enrol a user
      • Login as the user
      • Make a submission
      • Provide 0 mark for the assignment
      • The error occur

       

      We will need to check for final grade here:

       

      https://github.com/moodle/moodle/blob/main/mod/assign/classes/penalty/helper.php#L140

            Nguyen Nathan Nguyen
            Nguyen Nathan Nguyen
            Alexander Van der Bellen Alexander Van der Bellen
            Mihail Geshoski Mihail Geshoski
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 7 minutes
                1h 7m

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