Moodle
  1. Moodle
  2. MDL-39535

Grade calculation error displays multiple times.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.6, 2.4
    • Fix Version/s: 2.3.7, 2.4.4
    • Component/s: Gradebook
    • Labels:
      None
    • Testing Instructions:
      Hide

      You'll need a course with at least one student and at least two gradeable activities with ID numers.

      1. Visit the course and click on 'Grades'.
      2. Under 'Categories and items' click on 'Simple view'.
      3. Click 'Add grade item' and fill in the details and submit.
      4. After saving click on the calculator icon next to the newly created grade item and set the calculation to be equal to the sum of two other grade items ie =[[idnumberA]]+[[idnumberB]]
      5. Visit the course page and delete one of the activities that is relied upon by the calculated grade item.
      6. Click on 'Grades' which should take you to the 'User report' and ensure there is the message 'An error occurred during grade calculation: Probably circular reference or broken calculation formula' and not 'An error occurred during grade calculation: Probably circular reference or broken calculation formula,Probably circular reference or broken calculation formula'.
      7. Click on 'Export' to show the export options. Click on each of these and ensure the error message shows and is the same.
      Show
      You'll need a course with at least one student and at least two gradeable activities with ID numers. Visit the course and click on 'Grades'. Under 'Categories and items' click on 'Simple view'. Click 'Add grade item' and fill in the details and submit. After saving click on the calculator icon next to the newly created grade item and set the calculation to be equal to the sum of two other grade items ie =[ [idnumberA] ]+[ [idnumberB] ] Visit the course page and delete one of the activities that is relied upon by the calculated grade item. Click on 'Grades' which should take you to the 'User report' and ensure there is the message 'An error occurred during grade calculation: Probably circular reference or broken calculation formula' and not 'An error occurred during grade calculation: Probably circular reference or broken calculation formula,Probably circular reference or broken calculation formula'. Click on 'Export' to show the export options. Click on each of these and ensure the error message shows and is the same.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull Master Branch:
      MDL-39535_master

      Description

      See title.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Tim Hunt added a comment -

            -1 that looks like a lot of unnecessary code. Surely you can just do

            throw new moodle_exception('gradecantregrade', 'error', '', implode(', ', array_unique($regraderesult)));

            (Two changes there, add array_unique() and add a space after the comma in the implode.)

            Show
            Tim Hunt added a comment - -1 that looks like a lot of unnecessary code. Surely you can just do throw new moodle_exception('gradecantregrade', 'error', '', implode(', ', array_unique($regraderesult))); (Two changes there, add array_unique() and add a space after the comma in the implode.)
            Hide
            Tim Hunt added a comment -

            Oh dear. I always forget the manners bit. I should have started with "Thank you testings MDL-32913, and fining and reporting this issue. Thanks also for proposing a patch but ..."

            Show
            Tim Hunt added a comment - Oh dear. I always forget the manners bit. I should have started with "Thank you testings MDL-32913 , and fining and reporting this issue. Thanks also for proposing a patch but ..."
            Hide
            Adrian Greeve added a comment -

            I have to admit that I agree with Tim. If you use array_unique you could avoid a lot of unnecessary code.

            Show
            Adrian Greeve added a comment - I have to admit that I agree with Tim. If you use array_unique you could avoid a lot of unnecessary code.
            Hide
            Mark Nelson added a comment -

            Thanks guys, tbh I was not aware that the function array_unique existed. Submitting to integration now.

            Show
            Mark Nelson added a comment - Thanks guys, tbh I was not aware that the function array_unique existed. Submitting to integration now.
            Hide
            Damyon Wiese added a comment -

            Thanks Mark and Tim (the comments made me laugh).

            This is a nice solution - integrated to 23, 24 and master.

            Show
            Damyon Wiese added a comment - Thanks Mark and Tim (the comments made me laugh). This is a nice solution - integrated to 23, 24 and master.
            Hide
            Michael de Raadt added a comment -

            Starting testing...

            Show
            Michael de Raadt added a comment - Starting testing...
            Hide
            Michael de Raadt added a comment -

            Test result: Success.

            Tested in 2.3, 2.4 and master.

            Show
            Michael de Raadt added a comment - Test result: Success. Tested in 2.3, 2.4 and master.
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Did you think this day was not going to arrive ever?

            Your patience has been rewarded, yay, sent upstream, thanks!

            Closing...ciao

            Show
            Eloy Lafuente (stronk7) added a comment - Did you think this day was not going to arrive ever? Your patience has been rewarded, yay, sent upstream, thanks! Closing...ciao

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: