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

Setting the "Grade type" of a manual grade item to "None" removes it from the Gradebook UI

    Details

    • Testing Instructions:
      Hide

      Create a manual grade item. Check that you cannot set grade type to "None".

      Check that all behat and unit tests passed.

      Show
      Create a manual grade item. Check that you cannot set grade type to "None". Check that all behat and unit tests passed.
    • Workaround:
      Hide

      There are two methods available, both of them require editing the database directly:

      Firstly, go to the database and look in the grade_items table. Look for a manual grade item that has ## tokens in it, but which is not visible in the Gradebook GUI.

      Then either:

      1. Delete the record. Problem solved.

      2. Edit the record, changing the value of gradetype from 0 to 1 (this corresponds to changing the setting "Grade type" from "None" to "Value" in the Gradebook UI). The grade item now reappears in the Gradebook UI. Go to the Gradebook UI and either edit the grade item to remove the ##token, or delete it. Problem solved.

      Show
      There are two methods available, both of them require editing the database directly: Firstly, go to the database and look in the grade_items table. Look for a manual grade item that has ## tokens in it, but which is not visible in the Gradebook GUI. Then either: 1. Delete the record. Problem solved. 2. Edit the record, changing the value of gradetype from 0 to 1 (this corresponds to changing the setting "Grade type" from "None" to "Value" in the Gradebook UI). The grade item now reappears in the Gradebook UI. Go to the Gradebook UI and either edit the grade item to remove the ##token, or delete it. Problem solved.
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Epic Link:
    • Pull 2.6 Branch:
      MDL-43740_manual_none_26
    • Pull 2.7 Branch:
      MDL-43740_manual_none_27
    • Pull Master Branch:
      MDL-43740_manual_none
    • Sprint:
      BACKEND Sprint 15
    • Story Points (Obsolete):
      13
    • Sprint:
      BACKEND Sprint 15

      Description

      Symptoms (all related to the Gradebook):

      1. The Course Total column indicates "Error" for all students. (see screenshot 1)
      2. The User Report gives the following error message: "An error occurred during grade calculation: Probably circular reference or broken calculation formula." (see screenshot 2)
      3. The export to Excel spreadsheet function gives the following error message: "An error occurred during grade calculation: Probably circular reference or broken calculation formula." (see screenshot 3)
      4. There are no broken formulas in the Gradebook UI, meaning that there is no way to fix this error.

      Steps to reproduce:

      1. Create a manual grade item in the Gradebook.
      2. Enter a formula in the grade item, referring to another grade item, such as =SUM([[X]],[[Y]]).
      3. Then delete one of the grade items that are referred to in the aforementioned formula, e.g. delete the grade item referred to as "X".
      4. Examine the formula; it should now have a ## token indicating that it is pointing to a non-existent grade item.
      5. Edit the grade item and change the value of "Grade type" from "Value" to "None"
      6. Examine the Gradebook - THE ITEM HAS NOW DISAPPEARED FROM THE GRADEBOOK GUI.
      7. Examine the database (if possible) - the manual grade item still exists with gradetype=0 and the gradebook error persists. It is now only possible to solve this problem directly in the database.

      Cause:

      I have updated this report after our IT Support were able to track down the source of the problem.

      This problem is caused by the behaviour under item 6 in "Steps to Reproduce" above; namely, SETTING THE "GRADE TYPE" OF A MANUAL GRADE ITEM TO "NONE" REMOVES IT FROM THE GRADEBOOK GUI.

      This has happened on two separate courses which caused us major problems and it has taken us 6 months to track it down.

        Gliffy Diagrams

        1. 1.PNG
          8 kB
        2. 2.PNG
          12 kB
        3. 3.PNG
          10 kB

          Issue Links

            Activity

            Hide
            tsala Helen Foster added a comment -

            Timothy, thanks for your detailed report. I hope you can figure out how to reproduce the problem so that it can be investigated. You may wish to post on moodle.org in the gradebook forum https://moodle.org/mod/forum/view.php?id=2122 to ask if anyone else has encountered the same problem.

            Show
            tsala Helen Foster added a comment - Timothy, thanks for your detailed report. I hope you can figure out how to reproduce the problem so that it can be investigated. You may wish to post on moodle.org in the gradebook forum https://moodle.org/mod/forum/view.php?id=2122 to ask if anyone else has encountered the same problem.
            Hide
            jmarshall Josh Marshall added a comment -

            Another step to add to the workaround that does not require modification directly to the database:
            Go directly to the URL, i.e. http://yourmoodle.com/grade/edit/tree/item.php?courseid=xxxx&id=yyyy
            where xxxx is the Course ID and yyyy is the Grade Item ID found in the database.

            This will enable you to change the grade item type manually to "VALUE", then delete it.

            Show
            jmarshall Josh Marshall added a comment - Another step to add to the workaround that does not require modification directly to the database: Go directly to the URL, i.e. http://yourmoodle.com/grade/edit/tree/item.php?courseid=xxxx&id=yyyy where xxxx is the Course ID and yyyy is the Grade Item ID found in the database. This will enable you to change the grade item type manually to "VALUE", then delete it.
            Hide
            rrusso Robert Russo added a comment -

            https://github.com/lsuits/gradebook_patches/blob/master/ungraded_manual.patch

            The above patch will stop users from being able to change the grade type of manual items to none once applied.

            Show
            rrusso Robert Russo added a comment - https://github.com/lsuits/gradebook_patches/blob/master/ungraded_manual.patch The above patch will stop users from being able to change the grade type of manual items to none once applied.
            Hide
            andyjdavis Andrew Davis added a comment -

            I have been able to reproduce this. Looking at the supplied fix now. Thank you Robert

            Show
            andyjdavis Andrew Davis added a comment - I have been able to reproduce this. Looking at the supplied fix now. Thank you Robert
            Hide
            andyjdavis Andrew Davis added a comment -

            Unfortunately I don't think we can simply remove the "None" grade type. It does at least one useful application. http://elearning.med.monash.edu.au/moodlegrades-exclude-grade-items-unit-total

            Show
            andyjdavis Andrew Davis added a comment - Unfortunately I don't think we can simply remove the "None" grade type. It does at least one useful application. http://elearning.med.monash.edu.au/moodlegrades-exclude-grade-items-unit-total
            Hide
            rrusso Robert Russo added a comment -

            The link is talking about categories, not manual grade items.

            Manual grade items set to "none" has no use anywhere.

            Show
            rrusso Robert Russo added a comment - The link is talking about categories, not manual grade items. Manual grade items set to "none" has no use anywhere.
            Hide
            andyjdavis Andrew Davis added a comment -

            Yeah, I just reread it and you are right. They are talking about a category.

            I can't find one but there is definitely no way that this will affect non-manual grade items? ie assignments etc.

            Show
            andyjdavis Andrew Davis added a comment - Yeah, I just reread it and you are right. They are talking about a category. I can't find one but there is definitely no way that this will affect non-manual grade items? ie assignments etc.
            Hide
            andyjdavis Andrew Davis added a comment -

            I am currently running the relevant unit and behat tests to check for any adverse side effects.

            Show
            andyjdavis Andrew Davis added a comment - I am currently running the relevant unit and behat tests to check for any adverse side effects.
            Hide
            andyjdavis Andrew Davis added a comment -

            Everything appears fine. Putting this up for peer review.

            Show
            andyjdavis Andrew Davis added a comment - Everything appears fine. Putting this up for peer review.
            Hide
            cibot CiBoT added a comment -

            +1 code verified against automated checks.

            Checked MDL-43740 using repository: https://github.com/andyjdavis/moodle.git

            More information about this report

            Show
            cibot CiBoT added a comment - +1 code verified against automated checks. Checked MDL-43740 using repository: https://github.com/andyjdavis/moodle.git master (branch: MDL-43740_manual_none | CI Job ) More information about this report
            Hide
            damyon Damyon Wiese added a comment -

            Thanks Andrew - looks like a nice simple fix. 2 points to mention though - this needs backports and should we fix broken gradebook columns on upgrade (delete all manual grade items with grade type none). I would like to hear your opinion for/against the upgrade step.

            [Y] Syntax
            [Y] Whitespace
            [-] Output
            [Y] Language
            [-] Databases
            [Y] Testing (instructions and automated tests)
            [-] Security
            [-] Documentation
            [N] Git (missing backports)
            [-] Third party code
            [Y] Sanity check (pending upgrade step discussion)

            Cheers!

            Show
            damyon Damyon Wiese added a comment - Thanks Andrew - looks like a nice simple fix. 2 points to mention though - this needs backports and should we fix broken gradebook columns on upgrade (delete all manual grade items with grade type none). I would like to hear your opinion for/against the upgrade step. [Y] Syntax [Y] Whitespace [-] Output [Y] Language [-] Databases [Y] Testing (instructions and automated tests) [-] Security [-] Documentation [N] Git (missing backports) [-] Third party code [Y] Sanity check (pending upgrade step discussion) Cheers!
            Hide
            rrusso Robert Russo added a comment -

            The simplest upgrade solution is to add a SQL query to either remove the manual gradebook items set to none or set them to some other grade method.

            Show
            rrusso Robert Russo added a comment - The simplest upgrade solution is to add a SQL query to either remove the manual gradebook items set to none or set them to some other grade method.
            Hide
            andyjdavis Andrew Davis added a comment -

            I'm a bit wary of deleting any manual grade items with grade type none. Theoretically it should be fine but running delete queries during upgrade still makes me nervous.

            We definitely should not set them to have another grade type. Its quite possible that some site will have a bunch of these grade items and having them suddenly appear could throw out their grade calculations.

            Show
            andyjdavis Andrew Davis added a comment - I'm a bit wary of deleting any manual grade items with grade type none. Theoretically it should be fine but running delete queries during upgrade still makes me nervous. We definitely should not set them to have another grade type. Its quite possible that some site will have a bunch of these grade items and having them suddenly appear could throw out their grade calculations.
            Hide
            andyjdavis Andrew Davis added a comment -

            Here are 2.7 and 2.6 versions. I'm inclined to let sleeping dogs lie with any manual grade type "none" items that might exist.

            Show
            andyjdavis Andrew Davis added a comment - Here are 2.7 and 2.6 versions. I'm inclined to let sleeping dogs lie with any manual grade type "none" items that might exist.
            Hide
            andyjdavis Andrew Davis added a comment -

            Submitting for integration. I will take this back if it is determined that we really should do something about any manual grade type none items that might be hiding in the database.

            Show
            andyjdavis Andrew Davis added a comment - Submitting for integration. I will take this back if it is determined that we really should do something about any manual grade type none items that might be hiding in the database.
            Hide
            cibot CiBoT added a comment -

            Moving this issue to current integration cycle, will be reviewed soon. Thanks for the hard work!

            Show
            cibot CiBoT added a comment - Moving this issue to current integration cycle, will be reviewed soon. Thanks for the hard work!
            Hide
            marina Marina Glancy added a comment -

            I guess I tend to agree with Andrew that upgrade script will bring more confusion than help.

            Andrew, I think you should thank Robert Russo in the commit as your patch does exactly the same as his suggestion. And exclude the issue number from comment please, if somebody needs to find it they can do it running git blame. Thanks

            Show
            marina Marina Glancy added a comment - I guess I tend to agree with Andrew that upgrade script will bring more confusion than help. Andrew, I think you should thank Robert Russo in the commit as your patch does exactly the same as his suggestion. And exclude the issue number from comment please, if somebody needs to find it they can do it running git blame. Thanks
            Hide
            andyjdavis Andrew Davis added a comment -

            All done.

            Show
            andyjdavis Andrew Davis added a comment - All done.
            Hide
            marina Marina Glancy added a comment -

            Thanks Andrew, integrated in 2.6, 2.7 and master

            Show
            marina Marina Glancy added a comment - Thanks Andrew, integrated in 2.6, 2.7 and master
            Hide
            salvetore Michael de Raadt added a comment -

            So far I've manually tested this on 2.6, 2.7 and master. Unit tests have passed on all three branches (Windows+PostgreSQL). I'm waiting for Behat tests to complete on the CI server.

            Show
            salvetore Michael de Raadt added a comment - So far I've manually tested this on 2.6, 2.7 and master. Unit tests have passed on all three branches (Windows+PostgreSQL). I'm waiting for Behat tests to complete on the CI server.
            Hide
            salvetore Michael de Raadt added a comment -

            Behat tests are passing, so I can now pass this test.

            Show
            salvetore Michael de Raadt added a comment - Behat tests are passing, so I can now pass this test.
            Hide
            marina Marina Glancy added a comment -

            Thank you, your change is now upstream!

            Show
            marina Marina Glancy added a comment - Thank you, your change is now upstream!

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  8/Sep/14

                  Agile