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

Completion: When ratings off, disable grade completion

    Details

    • Testing Instructions:
      Hide

      0. Enable completion system at system and course level.
      1. Create a new Database
      2. Expand 'Activity completion' and select 'Show complete when conditions met'.
      3. Try to tick the 'Require grade' checkbox
      EXPECTED: Checkbox is disabled.
      4. Expand 'Ratings' and change 'Aggregate type' to something other than 'No ratings'.
      5. Try to tick the checkbox again.
      EXPECTED: Checkbox is enabled and can be ticked.

      (The following steps verify existing behaviour.)
      6. Create a new Quiz (quiz does not use ratings).
      7. Expand 'Activity completion' and select 'Show complete when conditions met'
      8. Try to tick the 'Require grade' checkbox.
      EXPECTED: Checkbox is enabled and can be ticked.
      9. Create a new Page (page cannot be graded at all).
      10. Expand 'Activity completion'.
      EXPECTED: There should be no 'Require grade' checkbox.

      Show
      0. Enable completion system at system and course level. 1. Create a new Database 2. Expand 'Activity completion' and select 'Show complete when conditions met'. 3. Try to tick the 'Require grade' checkbox EXPECTED: Checkbox is disabled. 4. Expand 'Ratings' and change 'Aggregate type' to something other than 'No ratings'. 5. Try to tick the checkbox again. EXPECTED: Checkbox is enabled and can be ticked. (The following steps verify existing behaviour.) 6. Create a new Quiz (quiz does not use ratings). 7. Expand 'Activity completion' and select 'Show complete when conditions met' 8. Try to tick the 'Require grade' checkbox. EXPECTED: Checkbox is enabled and can be ticked. 9. Create a new Page (page cannot be graded at all). 10. Expand 'Activity completion'. EXPECTED: There should be no 'Require grade' checkbox.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_23_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull Master Branch:
      MDL-27459-master

      Description

      Editing an already created Database activity gets the following error message:

      /////////////////////////////////////////////

      Debug info: Cannot find grade item for 'data'
      cm '18209' matching number '0'
      Stack trace:

      • line 1317 of /lib/completionlib.php: moodle_exception thrown
      • line 568 of /lib/completionlib.php: call to completion_info->internal_systemerror()
      • line 492 of /lib/completionlib.php: call to completion_info->internal_get_state()
      • line 789 of /lib/completionlib.php: call to completion_info->update_state()
      • line 342 of /course/modedit.php: call to completion_info->reset_all_state()

      /////////////////////////////////////////////

      To reproduce this error:
      1. create an ungraded Database activity
      2. save - no error appears at this point
      3. Access the Database activity and click on Edit Settings link
      4. Make changes, but make sure "Aggregate type" is set to "No ratings"
      5. Click on the [Save and display] button
      6. The above error message appears (this is with Debug messages set to "Developer"

      Workaround at this point is to click on the name of the Database activity in the breadcrumbs (not on the Continue button). Interestingly changes made while editing the activity seem to be saved as expected.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              andyjdavis Andrew Davis added a comment - - edited

              I've been able to reproduce this. If you have activity completion enabled, create a new database activity, set aggregate type to "no ratings", then set activity completion for the database to "show activity as complete when conditions are met" and tick "require grade" you will get an error when you save the database.

              An internal error occurred in the completion system. (System administrators can enable debugging information to see more detail.)
               
              More information about this error
              Debug info: Cannot find grade item for 'data'
              cm '1214' matching number '0'
              Stack trace:
               
                  * line 1329 of /lib/completionlib.php: moodle_exception thrown
                  * line 573 of /lib/completionlib.php: call to completion_info->internal_systemerror()
                  * line 497 of /lib/completionlib.php: call to completion_info->internal_get_state()
                  * line 794 of /lib/completionlib.php: call to completion_info->update_state()
                  * line 342 of /course/modedit.php: call to completion_info->reset_all_state()

              I'm guessing that no grade item is being created as the database is ungraded however course completion is assuming there will be one.

              Show
              andyjdavis Andrew Davis added a comment - - edited I've been able to reproduce this. If you have activity completion enabled, create a new database activity, set aggregate type to "no ratings", then set activity completion for the database to "show activity as complete when conditions are met" and tick "require grade" you will get an error when you save the database. An internal error occurred in the completion system. (System administrators can enable debugging information to see more detail.)   More information about this error Debug info: Cannot find grade item for 'data' cm '1214' matching number '0' Stack trace:   * line 1329 of /lib/completionlib.php: moodle_exception thrown * line 573 of /lib/completionlib.php: call to completion_info->internal_systemerror() * line 497 of /lib/completionlib.php: call to completion_info->internal_get_state() * line 794 of /lib/completionlib.php: call to completion_info->update_state() * line 342 of /course/modedit.php: call to completion_info->reset_all_state() I'm guessing that no grade item is being created as the database is ungraded however course completion is assuming there will be one.
              Hide
              andyjdavis Andrew Davis added a comment -

              I've just retested this and Im no longer getting the error. I'm not sure when however this has been fixed at some point.

              Show
              andyjdavis Andrew Davis added a comment - I've just retested this and Im no longer getting the error. I'm not sure when however this has been fixed at some point.
              Hide
              salvetore Michael de Raadt added a comment -

              This appears to have been closed prematurely. I just experienced this error in the latest master.

              Show
              salvetore Michael de Raadt added a comment - This appears to have been closed prematurely. I just experienced this error in the latest master.
              Hide
              andyjdavis Andrew Davis added a comment -

              Hello. I will not be able to work on this issue in the immediate future. In order to create a truer sense of the state of this issue and to allow other developers to have chance to become involved, I am removing myself as the assignee of this issue.

              For more information, see http://docs.moodle.org/dev/Changes_to_issue_assignment

              If you have any information about this issue or a possible fix please post it here

              Show
              andyjdavis Andrew Davis added a comment - Hello. I will not be able to work on this issue in the immediate future. In order to create a truer sense of the state of this issue and to allow other developers to have chance to become involved, I am removing myself as the assignee of this issue. For more information, see http://docs.moodle.org/dev/Changes_to_issue_assignment If you have any information about this issue or a possible fix please post it here
              Hide
              kevinbolshaw Kevin Bolshaw added a comment -

              This appears to be true of the glossary activity, as well. Could someone kindly program the Require grade> “Student must receive a grade to complete this activity “ box to gray out in the Activity completion section at the foot of the page if the grade aggregation type is set to "no ratings"? Or the software might warn against this.

              Show
              kevinbolshaw Kevin Bolshaw added a comment - This appears to be true of the glossary activity, as well. Could someone kindly program the Require grade> “Student must receive a grade to complete this activity “ box to gray out in the Activity completion section at the foot of the page if the grade aggregation type is set to "no ratings"? Or the software might warn against this.
              Hide
              quen Sam Marshall added a comment - - edited

              This code fix (as Kevin suggested) disables the tickbox when:

              a) the ratings system is enabled for the module
              and
              b) the ratings dropdown is set to 'no ratings'

              Think this should solve the problem...

              Show
              quen Sam Marshall added a comment - - edited This code fix (as Kevin suggested) disables the tickbox when: a) the ratings system is enabled for the module and b) the ratings dropdown is set to 'no ratings' Think this should solve the problem...
              Hide
              quen Sam Marshall added a comment -

              Submitting fix for review. I know everyone is busy now - I don't think this is critical for 2.7, it is just an existing minor bug in stable versions, delaying a few weeks should be fine.

              Show
              quen Sam Marshall added a comment - Submitting fix for review. I know everyone is busy now - I don't think this is critical for 2.7, it is just an existing minor bug in stable versions, delaying a few weeks should be fine.
              Hide
              cibot CiBoT added a comment -

              Results for MDL-27459

              Show
              cibot CiBoT added a comment - Results for MDL-27459 Remote repository: https://github.com/sammarshallou/moodle.git Remote branch MDL-27459 -m25 to be integrated into upstream MOODLE_25_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2859 Error: Unable to fetch information from MDL-27459 -m25 branch at https://github.com/sammarshallou/moodle.git . Remote branch MDL-27459 -m26 to be integrated into upstream MOODLE_26_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2860 Error: Unable to fetch information from MDL-27459 -m26 branch at https://github.com/sammarshallou/moodle.git . Remote branch MDL-27459 -master to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2861 Error: Unable to fetch information from MDL-27459 -master branch at https://github.com/sammarshallou/moodle.git .
              Hide
              samhemelryk Sam Hemelryk added a comment -

              HI Sam, looks like you forgot to push the branches to your github repo?

              Show
              samhemelryk Sam Hemelryk added a comment - HI Sam, looks like you forgot to push the branches to your github repo?
              Hide
              quen Sam Marshall added a comment -

              Argh, looks like you are right, sorry! Don't know what happened. Will try to fix it - am at Moodle Moot atm and having some trouble connecting to my work machine so it might be delayed, apologies.

              Show
              quen Sam Marshall added a comment - Argh, looks like you are right, sorry! Don't know what happened. Will try to fix it - am at Moodle Moot atm and having some trouble connecting to my work machine so it might be delayed, apologies.
              Hide
              quen Sam Marshall added a comment -

              Sorry, it turns out I got the number wrong in my branches, doh. I have rebased all three of them, hopefully correct now.

              Show
              quen Sam Marshall added a comment - Sorry, it turns out I got the number wrong in my branches, doh. I have rebased all three of them, hopefully correct now.
              Hide
              poltawski Dan Poltawski added a comment -

              Hi Sam,

              This looks good to me for integration. I would just argue that the testing instructions should be expanded a bit to cover scenarios beyond the bug in question (making sure that non-rating modules don't have a regression).

              Feel free to send for integration with those additional testing instructions.

              Show
              poltawski Dan Poltawski added a comment - Hi Sam, This looks good to me for integration. I would just argue that the testing instructions should be expanded a bit to cover scenarios beyond the bug in question (making sure that non-rating modules don't have a regression). Feel free to send for integration with those additional testing instructions.
              Hide
              quen Sam Marshall added a comment -

              Thanks Dan! Have expanded test instructions as suggested (and checked them myself, seems to work), now submitting for integration.

              Show
              quen Sam Marshall added a comment - Thanks Dan! Have expanded test instructions as suggested (and checked them myself, seems to work), now submitting for integration.
              Hide
              marina Marina Glancy added a comment -

              Thanks Sam, integrated in 2.5, 2.6 and master

              Very elegant solution. I thought it was too simple to be true and tested all edge cases I could think of but it works like a charm

              Show
              marina Marina Glancy added a comment - Thanks Sam, integrated in 2.5, 2.6 and master Very elegant solution. I thought it was too simple to be true and tested all edge cases I could think of but it works like a charm
              Hide
              andyjdavis Andrew Davis added a comment -

              Works as described. Passing.

              Show
              andyjdavis Andrew Davis added a comment - Works as described. Passing.
              Hide
              quen Sam Marshall added a comment -

              Thanks all. Marina: just for information, I first spent some time on a much less elegant solution involving changes across multiple files before I thought of this one.

              Show
              quen Sam Marshall added a comment - Thanks all. Marina: just for information, I first spent some time on a much less elegant solution involving changes across multiple files before I thought of this one.
              Hide
              poltawski Dan Poltawski added a comment -

              Thank you for your contribution! This change is now part of Moodle!

              Nothing is impossible, the word itself says 'I'm possible'!

              --Audrey Hepburn

              Show
              poltawski Dan Poltawski added a comment - Thank you for your contribution! This change is now part of Moodle! Nothing is impossible, the word itself says 'I'm possible'! --Audrey Hepburn

                People

                • Votes:
                  1 Vote for this issue
                  Watchers:
                  10 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    12/May/14