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

Poor error handling in calculation formula when activity is deleted

XMLWordPrintable

    • MOODLE_403_STABLE

      Currently if a grade item has an error in calculation formula we show incorrect results to a user.

      Steps to reproduce:

      1. Add quiz1 and quiz2 (using quiz just as example)
      2. Add id numbers for those grade items q1 and q2
      3. Add calculation formula for course total to be smth like [[q1]]+[[q2]]
      4. Add grades to a student for both items (like 1 and 3)
      5. Total shows 4 (being 1+3)
      6. Delete quiz2 and run cron
      7. Go to grader report
      8. Total shows Error as expected since formula is broken
      9. Reload the page
      10. Total shows Error as expected since formula is broken
      11. Go to quiz1
      12. Error is shown Error in the calculation of grade item {$a} which is expected since Total is broken
      13. Reload the page
      14. Error is gone somehow
      15. Go to grader report
      16. No error is shown and Total shows 4 (it stored in database) which is wrong

      Creating this issue to start some work to make it better. There are many steps that need to be taken into consideration and potentially can be done in separate issues. So some points to agree, investigate or to address:

      1. Do we want to show errors to students? We currently don't - we are showing wrong grade which is even worse. Perhaps we should show 0 when there is error? For example this logic seems to follow that path https://github.com/moodle/moodle/blob/main/mod/quiz/view.php#L138 if by whatever reason it couldn't get grade here https://github.com/moodle/moodle/blob/main/lib/gradelib.php#L538
      2. Does it affects completions? I.e. can the old 'wrong' grades mark completion incorrectly passed
      3. If we decide to treat the affected grades as error grades - how do we export those. How do we create a course back up with those. How do we import those? I guess no change - the old 'wrong value' is stored in db. And error can be handled after restore since gradeitem needsupdate=1
      4. We a need a mechanism to notify a teacher when he deletes a course module. So we need to know if a module to be deleted is used in any calculation formula and if yes have a warning
      5. To above - what do we do with a webservices for module deletion. Do we need to proceed with deletion and return a warning that deleted module was used?

       

            Unassigned Unassigned
            ilyatregubov Ilya Tregubov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 20 minutes
                20m

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