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

Buggy grading in lesson containing essays

    Details

    • Testing Instructions:
      Hide

      Login as teacher.
      1. create new lesson
      2. create multiple choices and essay questions.

      Login as student
      1. click on the lesson and answer the multiple choices and essay question

      Login as teacher
      1. click on the lesson
      2. click on 'Grade essays'
      3. click on the essay, give grade and save
      4. click on 'Reports'

      Student grade (percentage) should change.

      Lesson grade should also be updated on student page (login as student and click on 'gradebook').

      Show
      Login as teacher. 1. create new lesson 2. create multiple choices and essay questions. Login as student 1. click on the lesson and answer the multiple choices and essay question Login as teacher 1. click on the lesson 2. click on 'Grade essays' 3. click on the essay, give grade and save 4. click on 'Reports' Student grade (percentage) should change. Lesson grade should also be updated on student page (login as student and click on 'gradebook').
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-26788_head

      Description

      As reported on the Lesson forum here: http://moodle.org/mod/forum/discuss.php?d=170839 and here: http://moodle.org/mod/forum/discuss.php?d=170348
      Using Moodle 2.0.2+ (Build: 20110309).

      Scenario:

      Q1 multiple choice score /5
      Q2 multiple choice score /5
      Q3 essay score /10

      student answers
      Q1 correct (5/5)
      Q2 wrong (0/5)
      Q3 student writes essay

      end of lesson notice (before essay grading)
      You earned 15 out of 10 for the automatically graded questions.
      Your 1 essay question(s) will be graded and added into your final score at a later date.
      Your current grade without the essay question(s) is 15 out of 20

      Grade report: Lesson: 75%

      teacher marks Q3 essay 5/10
      Grade of essay is not saved
      Grade report: Lesson: 75% (not changed)

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            tsala Helen Foster added a comment -

            Joseph, thanks for your report with clear description. Hoping this issue can be fixed soon.

            Show
            tsala Helen Foster added a comment - Joseph, thanks for your report with clear description. Hoping this issue can be fixed soon.
            Hide
            tsala Helen Foster added a comment -

            Andrew added as watcher in case this is more a gradebook issue than a lesson issue.

            Show
            tsala Helen Foster added a comment - Andrew added as watcher in case this is more a gradebook issue than a lesson issue.
            Hide
            rezeau Joseph Rézeau added a comment -

            Hi Helen and Andrew,
            Just to mention that that bug now has 14 votes...and fixing is still pending.
            Joseph

            Show
            rezeau Joseph Rézeau added a comment - Hi Helen and Andrew, Just to mention that that bug now has 14 votes...and fixing is still pending. Joseph
            Hide
            rwijaya Rossiani Wijaya added a comment -

            Hi Joseph,

            I just created a patch to fix the issue. When you have a chance, could you test the patch and let me know if it fixes the issue?

            Patch: https://github.com/rwijaya/moodle/compare/MOODLE_20_STABLE...MDL-26788_m20

            Thanks
            Rosie

            Show
            rwijaya Rossiani Wijaya added a comment - Hi Joseph, I just created a patch to fix the issue. When you have a chance, could you test the patch and let me know if it fixes the issue? Patch: https://github.com/rwijaya/moodle/compare/MOODLE_20_STABLE...MDL-26788_m20 Thanks Rosie
            Hide
            rezeau Joseph Rézeau added a comment -

            Hi Rosie,
            Just tested your patch. Things look better for the first part of my scenario, but the essay grade is still not recorded. Here is the new scenario:

            Scenario:

            Q1 multiple choice score /5
            Q2 multiple choice score /5
            Q3 essay score /10

            student answers
            Q1 correct (5/5)
            Q2 wrong (0/5)
            Q3 student writes essay

            Congratulations - end of lesson reached
            You earned 5 out of 10 for the automatically graded questions.
            Your 1 essay question(s) will be graded and added
            into your final score at a later date.

            Your current grade without the essay question(s) is 5 out of 20
            Grade report: Lesson: 25%

            teacher marks Q3 essay 5/10
            Grade of essay is not saved
            Grade report: Lesson: 25% (not changed)

            Hope you can fix the "Essay grade not saved" bug...

            Show
            rezeau Joseph Rézeau added a comment - Hi Rosie, Just tested your patch. Things look better for the first part of my scenario, but the essay grade is still not recorded. Here is the new scenario: Scenario: Q1 multiple choice score /5 Q2 multiple choice score /5 Q3 essay score /10 student answers Q1 correct (5/5) Q2 wrong (0/5) Q3 student writes essay Congratulations - end of lesson reached You earned 5 out of 10 for the automatically graded questions. Your 1 essay question(s) will be graded and added into your final score at a later date. Your current grade without the essay question(s) is 5 out of 20 Grade report: Lesson: 25% — teacher marks Q3 essay 5/10 Grade of essay is not saved Grade report: Lesson: 25% (not changed) Hope you can fix the "Essay grade not saved" bug...
            Hide
            rwijaya Rossiani Wijaya added a comment -

            Hi Joseph,

            Thank you for testing. Question regarding the issue, do you have any specific setting for the lesson?

            I can't reproduce the error based on the above scenario.

            Adding Apu to review the patch.

            Show
            rwijaya Rossiani Wijaya added a comment - Hi Joseph, Thank you for testing. Question regarding the issue, do you have any specific setting for the lesson? I can't reproduce the error based on the above scenario. Adding Apu to review the patch.
            Hide
            rwijaya Rossiani Wijaya added a comment -

            Hi Apu,

            When you have a chance, could you take a look the patch?

            Thanks
            Rosie

            Show
            rwijaya Rossiani Wijaya added a comment - Hi Apu, When you have a chance, could you take a look the patch? Thanks Rosie
            Hide
            rezeau Joseph Rézeau added a comment -

            Hi Rosie,
            Sorry about my previous comment. Just tried again and your patch is working fine !
            Thank you,
            Joseph

            Show
            rezeau Joseph Rézeau added a comment - Hi Rosie, Sorry about my previous comment. Just tried again and your patch is working fine ! Thank you, Joseph
            Hide
            nebgor Aparup Banerjee added a comment -

            Hi Rosie,
            The code looks okay to me.
            oh, Have you considered implementing the fix in a small class that overrides the earned_score() method ?
            cheers,
            Aparup

            Show
            nebgor Aparup Banerjee added a comment - Hi Rosie, The code looks okay to me. oh, Have you considered implementing the fix in a small class that overrides the earned_score() method ? cheers, Aparup
            Hide
            rwijaya Rossiani Wijaya added a comment -

            Have discussion with Aparup regarding class overrides that required instantiating unnecessary method for earned_score(). We decided not to create new class to fix the issue.

            Thanks Joseph and Aparup for testing the patch.

            Rosie

            Show
            rwijaya Rossiani Wijaya added a comment - Have discussion with Aparup regarding class overrides that required instantiating unnecessary method for earned_score(). We decided not to create new class to fix the issue. Thanks Joseph and Aparup for testing the patch. Rosie
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment - - edited

            Hi Rossie, which is the cause for moving the:

            $essayinfo->score = clean_param($form->score, PARAM_INT);

            to:

            $score = optional_param('score', 0, PARAM_INT);

            IMO, if it's part of the $form, it should be handled in the former way, I think the second is better for GET requests and friends.

            Ciao

            Edited: In fact, the essay_form already has the type for 'score' defined as integer, that should be enough to get the field automatically cleaned, isn't it? So perhaps none of them are needed and cleaned info is already in $mform->score ?

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - - edited Hi Rossie, which is the cause for moving the: $essayinfo->score = clean_param($form->score, PARAM_INT); to: $score = optional_param('score', 0, PARAM_INT); IMO, if it's part of the $form, it should be handled in the former way, I think the second is better for GET requests and friends. Ciao Edited: In fact, the essay_form already has the type for 'score' defined as integer, that should be enough to get the field automatically cleaned, isn't it? So perhaps none of them are needed and cleaned info is already in $mform->score ?
            Hide
            nebgor Aparup Banerjee added a comment - - edited

            i've quickly tried the below without luck. didn't work.
            $essayinfo->score = $form->score;

            $form has : stdClass Object\n(\n [id] => 135\n [attemptid] => 373\n [mode] => update\n [response] => sfedsferdfv\n [submitbutton] => Save changes\n)\n

            $form->score probably needs to be cleaned up, its not used anywhere else that i can see.. but Rossi's patch works.

            Show
            nebgor Aparup Banerjee added a comment - - edited i've quickly tried the below without luck. didn't work. $essayinfo->score = $form->score; $form has : stdClass Object\n(\n [id] => 135\n [attemptid] => 373\n [mode] => update\n [response] => sfedsferdfv\n [submitbutton] => Save changes\n)\n $form->score probably needs to be cleaned up, its not used anywhere else that i can see.. but Rossi's patch works.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Ok, this has been integrated in its current status as far as 2.0.3 release is imminent and testing reports are ok.

            Anyway, plz, fill a new MDL issue about reviewing why that stuff is not coming in the $form and how it should be fixed / improved.

            Ciao

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Ok, this has been integrated in its current status as far as 2.0.3 release is imminent and testing reports are ok. Anyway, plz, fill a new MDL issue about reviewing why that stuff is not coming in the $form and how it should be fixed / improved. Ciao
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Test passed based in previous reports about it working.

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Test passed based in previous reports about it working.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Closing as fixed. Many thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Closing as fixed. Many thanks!

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  5/May/11