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

Lesson module reports wring grade to gradebook

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.3
    • Fix Version/s: 1.9.5
    • Component/s: Gradebook, Lesson
    • Labels:
      None
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      Lesson module sends all time 100 % results to the gradebook. Attached is a screen with a lesson result 67% thats shown in gradebook as 10 point (100 %.).

      MDL-16355 and MDL-12883 discuss parts of this problems. MDL-16355 didn't solve it.
      See also: http://moodle.org/mod/forum/discuss.php?d=98346

        Gliffy Diagrams

        1. lesson_grade.patch
          2 kB
          Mark Nielsen
        2. lesson_grade2.patch
          2 kB
          Mark Nielsen
        3. lesson_grade3.patch
          3 kB
          Mark Nielsen
        1. lesson_grade.png
          62 kB
        2. screenshot-1.jpg
          97 kB

          Issue Links

          There are no Sub-Tasks for this issue.

            Activity

            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Assigning to Mark and addessing for 1.9.4. Thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Assigning to Mark and addessing for 1.9.4. Thanks!
            Hide
            rezeau Joseph Rézeau added a comment -

            BUMP!
            This is a major bug and should really be fixed ASAP.
            See http://moodle.org/mod/forum/discuss.php?d=98346
            Thanks in advance,
            Joseph

            Show
            rezeau Joseph Rézeau added a comment - BUMP! This is a major bug and should really be fixed ASAP. See http://moodle.org/mod/forum/discuss.php?d=98346 Thanks in advance, Joseph
            Hide
            rezeau Joseph Rézeau added a comment -

            This shows clearly the bug in the Gradebook.

            Show
            rezeau Joseph Rézeau added a comment - This shows clearly the bug in the Gradebook.
            Hide
            laholmes LA Holmes added a comment -

            This IS a problem. How ever many points you get on a lesson, that same number becomes your percentage score! 5 out of 5 points becomes a score of 5%. Thanks for your attention to this.

            Show
            laholmes LA Holmes added a comment - This IS a problem. How ever many points you get on a lesson, that same number becomes your percentage score! 5 out of 5 points becomes a score of 5%. Thanks for your attention to this.
            Hide
            dburdick Debra Burdick added a comment -

            Any progress on this? This bug has completed disabled our ability to use Lesson as a graded item unless we complete rework the gradebook into weighted categories and completely redoing the gradebook for all our classes with graded lessons in the middle of the semester is really not an option. We have 1.9.2+ PLEASE HELP ASAP. This combined with other gradebook challenges is really decreasing the moodle enthusiasm to a level I have never seen. I fear serous mutiny. This lesson problem is the last straw for many but if it can be fixed quickly their might be hope. Appreciate whatever anyone could do. I would help if I had the skills.

            Show
            dburdick Debra Burdick added a comment - Any progress on this? This bug has completed disabled our ability to use Lesson as a graded item unless we complete rework the gradebook into weighted categories and completely redoing the gradebook for all our classes with graded lessons in the middle of the semester is really not an option. We have 1.9.2+ PLEASE HELP ASAP. This combined with other gradebook challenges is really decreasing the moodle enthusiasm to a level I have never seen. I fear serous mutiny. This lesson problem is the last straw for many but if it can be fixed quickly their might be hope. Appreciate whatever anyone could do. I would help if I had the skills.
            Hide
            cgkel Carl Keller added a comment -

            Hi All:

            I've encountered a bug in the lesson module that may be related to this issue in at least two builds of 1.9.4+. I'm currently running 1.9.4+ (Build: 20090218).

            Environment: php 5.2.8, V1.9.4+ (Build: 20090218), MySQL 5.0.67-community, Apache 2.2.11 (Unix), Perl 5.8.8, Operating system Linux Kernel 2.6.28

            Any time a question includes a short answer, the question attempt is recorded. However, the response is not recorded as correct even if it was correct. This causes the student score to be incorrect. The lesson pages process correctly. The correct feed back is displayed. Everything appears to work perfectly, except that he total score for the lesson is not incremented properly.

            Between my hosting company and myself, we have done some fairly extensive trouble shooting, and it looks like it is a bug.

            This is really becoming a problem on our site!

            Show
            cgkel Carl Keller added a comment - Hi All: I've encountered a bug in the lesson module that may be related to this issue in at least two builds of 1.9.4+. I'm currently running 1.9.4+ (Build: 20090218). Environment: php 5.2.8, V1.9.4+ (Build: 20090218), MySQL 5.0.67-community, Apache 2.2.11 (Unix), Perl 5.8.8, Operating system Linux Kernel 2.6.28 Any time a question includes a short answer, the question attempt is recorded. However, the response is not recorded as correct even if it was correct. This causes the student score to be incorrect. The lesson pages process correctly. The correct feed back is displayed. Everything appears to work perfectly, except that he total score for the lesson is not incremented properly. Between my hosting company and myself, we have done some fairly extensive trouble shooting, and it looks like it is a bug. This is really becoming a problem on our site!
            Hide
            rezeau Joseph Rézeau added a comment -

            @ Carl Keller
            More specifically this is what I have observed with latest 1.9.4 version.
            if lesson parameter custom scoring is set to YES, then all question types will record the correct scores
            if lesson parameter custom scoring is set to NO, then all question types will record the correct scores EXCEPT short answer!

            There are obviously serious bugs in the scoring system in the Lesson module. Mark, please can you fix those ASAP?
            Thanks
            Joseph

            Show
            rezeau Joseph Rézeau added a comment - @ Carl Keller More specifically this is what I have observed with latest 1.9.4 version. if lesson parameter custom scoring is set to YES, then all question types will record the correct scores if lesson parameter custom scoring is set to NO, then all question types will record the correct scores EXCEPT short answer! There are obviously serious bugs in the scoring system in the Lesson module. Mark, please can you fix those ASAP? Thanks Joseph
            Hide
            bushido Mark Nielsen added a comment -

            Looks like the problem is that the lesson module stores percentages in its grade table and then was sending the percentage to the gradebook instead of the raw grade.

            I'm attaching a patch that should now send the correct grade to the gradebook and also fix current grades via a lesson upgrade (so, need to visit Site Administration > Notifications). If anyone would like to test the patch, that would be fantastic! Just remember to use it on a copy of your database and that the patch is not finalized yet.

            I'd like someone from core to review the patch before it goes in as I'm not the most familiar with gradebook nor am I certain if the version bump was done correctly (I think it's OK, but don't want to mess up upgrades to 2.0).

            Show
            bushido Mark Nielsen added a comment - Looks like the problem is that the lesson module stores percentages in its grade table and then was sending the percentage to the gradebook instead of the raw grade. I'm attaching a patch that should now send the correct grade to the gradebook and also fix current grades via a lesson upgrade (so, need to visit Site Administration > Notifications). If anyone would like to test the patch, that would be fantastic! Just remember to use it on a copy of your database and that the patch is not finalized yet. I'd like someone from core to review the patch before it goes in as I'm not the most familiar with gradebook nor am I certain if the version bump was done correctly (I think it's OK, but don't want to mess up upgrades to 2.0).
            Hide
            bushido Mark Nielsen added a comment -

            Also, in the patch, the same snippet of code is executed in upgrade.php for different versions (once for the gradebook update and now for this fix). I'm wondering if I should try to prevent that from happening twice or not (that being calling lesson_update_grades() twice in one upgrade).

            Show
            bushido Mark Nielsen added a comment - Also, in the patch, the same snippet of code is executed in upgrade.php for different versions (once for the gradebook update and now for this fix). I'm wondering if I should try to prevent that from happening twice or not (that being calling lesson_update_grades() twice in one upgrade).
            Hide
            bushido Mark Nielsen added a comment -

            Petr, from what I understand, you are familiar with the gradebook upgrade, etc. Could you take a look at the patch when you get a chance?

            Show
            bushido Mark Nielsen added a comment - Petr, from what I understand, you are familiar with the gradebook upgrade, etc. Could you take a look at the patch when you get a chance?
            Hide
            bushido Mark Nielsen added a comment -

            Updated the patch based on Petr's recommendations.

            Show
            bushido Mark Nielsen added a comment - Updated the patch based on Petr's recommendations.
            Hide
            rezeau Joseph Rézeau added a comment -

            @Mark
            I applied your most recent patch (lesson_grade2.patch) to my current moodle 1.9.4 local installation.
            1- it works OK as far as grades are concerned
            2- but it throws an error when I delete selected attempts:

            Notice: Trying to get property of non-object in C:\Program Files\xampp\htdocs\moodle19dev\moodle\mod\lesson\lib.php on line 433
            Fatal error: Cannot use object of type object as array in C:\Program Files\xampp\htdocs\moodle19dev\moodle\mod\lesson\lib.php on line 433

            Joseph

            Show
            rezeau Joseph Rézeau added a comment - @Mark I applied your most recent patch (lesson_grade2.patch) to my current moodle 1.9.4 local installation. 1- it works OK as far as grades are concerned 2- but it throws an error when I delete selected attempts: Notice: Trying to get property of non-object in C:\Program Files\xampp\htdocs\moodle19dev\moodle\mod\lesson\lib.php on line 433 Fatal error: Cannot use object of type object as array in C:\Program Files\xampp\htdocs\moodle19dev\moodle\mod\lesson\lib.php on line 433 Joseph
            Hide
            bushido Mark Nielsen added a comment -

            Good catch. It appears that $grades can be several different values and types. Looking into a solution now.

            Show
            bushido Mark Nielsen added a comment - Good catch. It appears that $grades can be several different values and types. Looking into a solution now.
            Hide
            bushido Mark Nielsen added a comment -

            Attaching a new patch (lesson_grade3.patch). Looks like grade_update() eventually converts $grades to an array of arrays. The lesson code now does this as it calculates the raw grade.

            Show
            bushido Mark Nielsen added a comment - Attaching a new patch (lesson_grade3.patch). Looks like grade_update() eventually converts $grades to an array of arrays. The lesson code now does this as it calculates the raw grade.
            Hide
            dburdick Debra Burdick added a comment -

            so am I correct in assuming the grade2 patch is for v1.9.2+ That is the version we are having issues with. If so will have remote learner install and I can go in and see if that worked. thanks for your efforts. This has been a nightmare for instructors with lots of graded lessons.

            Show
            dburdick Debra Burdick added a comment - so am I correct in assuming the grade2 patch is for v1.9.2+ That is the version we are having issues with. If so will have remote learner install and I can go in and see if that worked. thanks for your efforts. This has been a nightmare for instructors with lots of graded lessons.
            Hide
            bushido Mark Nielsen added a comment -

            lesson_grade3,patch is the current one, not lesson_grade2.patch. The patch is against 1.9.4+ (Build: 20090224), which is the llatest in MOODLE_19_STABLE. The patch has not been finalized yet, Petr was planning on testing it today.

            Show
            bushido Mark Nielsen added a comment - lesson_grade3,patch is the current one, not lesson_grade2.patch. The patch is against 1.9.4+ (Build: 20090224), which is the llatest in MOODLE_19_STABLE. The patch has not been finalized yet, Petr was planning on testing it today.
            Hide
            dburdick Debra Burdick added a comment -

            So is a patch going to be created for version Moodle 1.9.2+ (Build: 20080813)
            I am the original person who posted this on moodle.org and Joseph so kindly posted this in tracker.
            We can not upgrade to 1.9.4+ because we have activity locking installed and it is not stable for v1.9.4+

            Show
            dburdick Debra Burdick added a comment - So is a patch going to be created for version Moodle 1.9.2+ (Build: 20080813) I am the original person who posted this on moodle.org and Joseph so kindly posted this in tracker. We can not upgrade to 1.9.4+ because we have activity locking installed and it is not stable for v1.9.4+
            Hide
            skodak Petr Skoda added a comment -

            looking at the code, I think the grade altering should would look much better in lesson_get_user_grades() , right?

            Show
            skodak Petr Skoda added a comment - looking at the code, I think the grade altering should would look much better in lesson_get_user_grades() , right?
            Hide
            skodak Petr Skoda added a comment -

            I hope you backported all the security patches somehow, if not you are in big trouble

            Show
            skodak Petr Skoda added a comment - I hope you backported all the security patches somehow, if not you are in big trouble
            Hide
            bushido Mark Nielsen added a comment -

            "looking at the code, I think the grade altering should would look much better in lesson_get_user_grades() , right? "

            That would assume that the only grades that are passed to lesson_grade_item_update() are from lesson_get_user_grades(). Doesn't seem like a safe assumption, but maybe it is? I'm not sure what else might call lesson_grade_item_update().

            Show
            bushido Mark Nielsen added a comment - "looking at the code, I think the grade altering should would look much better in lesson_get_user_grades() , right? " That would assume that the only grades that are passed to lesson_grade_item_update() are from lesson_get_user_grades(). Doesn't seem like a safe assumption, but maybe it is? I'm not sure what else might call lesson_grade_item_update().
            Hide
            skodak Petr Skoda added a comment -

            Full text search is your best friend if you need to know how and where are xxx_grade_item_update() used

            Show
            skodak Petr Skoda added a comment - Full text search is your best friend if you need to know how and where are xxx_grade_item_update() used
            Hide
            cgkel Carl Keller added a comment -

            Hi All:

            Will someone please point me toward a resource explaining how to install this patch on a shared server? Our online courses are really in a bind over this because they rely heavily on lessons for grading. Also please see MDL-18347.

            Thanks!

            Show
            cgkel Carl Keller added a comment - Hi All: Will someone please point me toward a resource explaining how to install this patch on a shared server? Our online courses are really in a bind over this because they rely heavily on lessons for grading. Also please see MDL-18347 . Thanks!
            Hide
            bushido Mark Nielsen added a comment -

            Petr, where are we with this patch? Can it be applied yet?

            Show
            bushido Mark Nielsen added a comment - Petr, where are we with this patch? Can it be applied yet?
            Hide
            bushido Mark Nielsen added a comment -

            Committed to 1.9 branch and merge to trunk. Had to modify the upgrade code to match the new API in Moodle 2.0.

            Show
            bushido Mark Nielsen added a comment - Committed to 1.9 branch and merge to trunk. Had to modify the upgrade code to match the new API in Moodle 2.0.
            Hide
            dburdick Debra Burdick added a comment -

            so will this fix version 1.9.2+ we are dying! help! remote-learner is trying hard to assist. We can not upgrade to 1.9.4. Thanks for your help!

            Show
            dburdick Debra Burdick added a comment - so will this fix version 1.9.2+ we are dying! help! remote-learner is trying hard to assist. We can not upgrade to 1.9.4. Thanks for your help!
            Hide
            bushido Mark Nielsen added a comment -

            Not entirely sure what's in the 1.9.2+ code. If you cannot upgrade, then your best bet would probably be to try to apply lesson_grade3.patch (attached to this ticket). Please test on a copy of your code and database. If that doesn't work, then you'll need a programmer to look at your specific code and derive a solution for it.

            Show
            bushido Mark Nielsen added a comment - Not entirely sure what's in the 1.9.2+ code. If you cannot upgrade, then your best bet would probably be to try to apply lesson_grade3.patch (attached to this ticket). Please test on a copy of your code and database. If that doesn't work, then you'll need a programmer to look at your specific code and derive a solution for it.
            Hide
            bushido Mark Nielsen added a comment -

            Actually, I take some of that back. You may upgrade your lesson module past incremental upgrades that might be introduced between your version and the current 1.9 version. So, you'll have to have a programmer to look at your code and see what can be done.

            Show
            bushido Mark Nielsen added a comment - Actually, I take some of that back. You may upgrade your lesson module past incremental upgrades that might be introduced between your version and the current 1.9 version. So, you'll have to have a programmer to look at your code and see what can be done.
            Hide
            timhunt Tim Hunt added a comment -

            When I upgrade HEAD I get:

            Warning: Missing argument 1 for lesson_update_grades(), called in /home/tim/Workspace/moodle_head/mod/lesson/db/upgrade.php on line 52 and defined in /home/tim/Workspace/moodle_head/mod/lesson/lib.php on line 383

            Also,

            $DB->set_debug(false);
            lesson_update_grades();
            $DB->set_debug(true);

            is unnecessary (and evil) in HEAD. We have stopped outputting successful SQL there, so actually, the $DB->set_debug(false); is irrelevant, and that $DB->set_debug(true); screws things up.

            Ah, I think the call should be to lesson_upGRADE_grades, but I am guessing. I'll checking the changes, since they make the error messgage go away, but I will leave this bug reopened because:

            • Someone who understands should review the chagnes.
            • The change may need backporting to 1.9 branch, and I have not done that.
            Show
            timhunt Tim Hunt added a comment - When I upgrade HEAD I get: Warning: Missing argument 1 for lesson_update_grades(), called in /home/tim/Workspace/moodle_head/mod/lesson/db/upgrade.php on line 52 and defined in /home/tim/Workspace/moodle_head/mod/lesson/lib.php on line 383 Also, $DB->set_debug(false); lesson_update_grades(); $DB->set_debug(true); is unnecessary (and evil) in HEAD. We have stopped outputting successful SQL there, so actually, the $DB->set_debug(false); is irrelevant, and that $DB->set_debug(true); screws things up. Ah, I think the call should be to lesson_upGRADE_grades, but I am guessing. I'll checking the changes, since they make the error messgage go away, but I will leave this bug reopened because: Someone who understands should review the chagnes. The change may need backporting to 1.9 branch, and I have not done that.
            Hide
            bushido Mark Nielsen added a comment -

            Tim, your right, the function that needs to be call in HEAD is lesson_upgrade_grades() - it's a new function in trunk which does what lesson_update_grades() did when no parameters are passed. Removing the debug lines is fine, I didn't know about that change.

            Nothing should be backported as I believe these are all HEAD specific issues.

            Let me know if your committing your code or if I should make the changes and commit.

            Show
            bushido Mark Nielsen added a comment - Tim, your right, the function that needs to be call in HEAD is lesson_upgrade_grades() - it's a new function in trunk which does what lesson_update_grades() did when no parameters are passed. Removing the debug lines is fine, I didn't know about that change. Nothing should be backported as I believe these are all HEAD specific issues. Let me know if your committing your code or if I should make the changes and commit.
            Hide
            bushido Mark Nielsen added a comment -

            Never mind, just noticed that you committed already. Looks good to me.

            Show
            bushido Mark Nielsen added a comment - Never mind, just noticed that you committed already. Looks good to me.
            Hide
            cgkel Carl Keller added a comment -

            Hi Guys!

            I have upgraded to the latest version, and I my lessons still won't increment properly when short answers are used! Any ideas? This is quite an issue for us.

            Thanks!

            Show
            cgkel Carl Keller added a comment - Hi Guys! I have upgraded to the latest version, and I my lessons still won't increment properly when short answers are used! Any ideas? This is quite an issue for us. Thanks!
            Hide
            plasteq Lukasz Sanokowski added a comment -

            Hello Everybody

            I use Moodle 1.9.4+. I patched all three of files using patch 'lesson_grade3.patch', but lesson grades in gradebook are still displayed always as 100%.

            Regards

            Show
            plasteq Lukasz Sanokowski added a comment - Hello Everybody I use Moodle 1.9.4+. I patched all three of files using patch 'lesson_grade3.patch', but lesson grades in gradebook are still displayed always as 100%. Regards
            Hide
            bushido Mark Nielsen added a comment -

            The patch has been applied to the code already and is in the weekly download (http://download.moodle.org/). Did you visit the admin notifications area to run database updates? And did you try attempting a lesson to see if you get 100% in the gradebook while not getting a perfect score?

            Show
            bushido Mark Nielsen added a comment - The patch has been applied to the code already and is in the weekly download ( http://download.moodle.org/ ). Did you visit the admin notifications area to run database updates? And did you try attempting a lesson to see if you get 100% in the gradebook while not getting a perfect score?
            Hide
            plasteq Lukasz Sanokowski added a comment -

            Thanks for Your response.

            When i attempt a lesson after applying patch, and my score is not 100%, the grade shown in gradebook is displayed propertly. But attempts made before patching are still displayed always as 100%. Entering in admin notification does not applying database updates.

            Finally I changed whole /mod/lesson/ folder to this taken from latest weekly download, but admin notification still do not apply database updates, and previous lesson attempts are shown as 100% in gradebook. I changed grade of this attempts manually, because there was very few of them.

            Regards, ?ukasz

            Show
            plasteq Lukasz Sanokowski added a comment - Thanks for Your response. When i attempt a lesson after applying patch, and my score is not 100%, the grade shown in gradebook is displayed propertly. But attempts made before patching are still displayed always as 100%. Entering in admin notification does not applying database updates. Finally I changed whole /mod/lesson/ folder to this taken from latest weekly download, but admin notification still do not apply database updates, and previous lesson attempts are shown as 100% in gradebook. I changed grade of this attempts manually, because there was very few of them. Regards, ?ukasz
            Hide
            skodak Petr Skoda added a comment -

            what is the status of this issue?

            Show
            skodak Petr Skoda added a comment - what is the status of this issue?
            Hide
            cgkel Carl Keller added a comment -

            Hi Petr:

            As far as I am concerned, the lesson part of the issue was fixed when I installed the updated download that Mark Nielsen mentioned in his comment on 24/Mar/09 01:39 AM.

            Show
            cgkel Carl Keller added a comment - Hi Petr: As far as I am concerned, the lesson part of the issue was fixed when I installed the updated download that Mark Nielsen mentioned in his comment on 24/Mar/09 01:39 AM.
            Hide
            skodak Petr Skoda added a comment -

            resolving as fixed, please file a new issue if needed, thanks everybody

            Show
            skodak Petr Skoda added a comment - resolving as fixed, please file a new issue if needed, thanks everybody
            Hide
            andyjdavis Andrew Davis added a comment -

            I created a lesson with a maximum grade of 5. Completed the lesson as a student and my grade appears to be being correctly represented on the grader report. I was also able to delete attempts at the lesson without an error. Closing.

            Show
            andyjdavis Andrew Davis added a comment - I created a lesson with a maximum grade of 5. Completed the lesson as a student and my grade appears to be being correctly represented on the grader report. I was also able to delete attempts at the lesson without an error. Closing.

              People

              • Votes:
                11 Vote for this issue
                Watchers:
                12 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/May/09