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

Lesson using a scale always gives the minimum scale value

    Details

    • Testing Instructions:
      Hide

      Create a scale like:

      • Name: "Out of 5"
      • Scale:

        "*,**,***,****,*****"


        Create a lesson

      • Using this scale
      • Create a few questions
        Do the lesson as a student
      • Get all the questions right and you will get

         "*****"

        for you gradebook score.

      Show
      Create a scale like: Name: "Out of 5" Scale: "*,**,***,****,*****" Create a lesson Using this scale Create a few questions Do the lesson as a student Get all the questions right and you will get "*****" for you gradebook score.
    • Workaround:
      Hide

      Use a grade value out of 5

      Show
      Use a grade value out of 5
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      mdl43020-master

      Description

      Lesson using a scale always gives the minimum scale value because when calculating out of 100% it is always negative. Therefore gradebook gives the minimum grade.

      When converting a score to a scale, use scale's grade maximum to calculate it.

      (score * scale max grade) / 100

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              salvetore Michael de Raadt added a comment -

              This may also resolve MDL-40212. That should be tested when this fix is integrated.

              Show
              salvetore Michael de Raadt added a comment - This may also resolve MDL-40212 . That should be tested when this fix is integrated.
              Hide
              salvetore Michael de Raadt added a comment -

              Thanks for reporting this and providing a patch.

              Show
              salvetore Michael de Raadt added a comment - Thanks for reporting this and providing a patch.
              Hide
              rwijaya Rossiani Wijaya added a comment -

              Hi Tim,

              Thank you for providing patch to fix this issue.

              Some feedback for the patch:
              On line 473, I think it would be better to add a check and make sure that $grades is not null. Do the same check for line 474 for $grade->items.

              When I tested this, I got the following warning and notice:

              Warning: reset() expects parameter 1 to be array, null given in /stable/master/mod/lesson/lib.php on line 472 
              Notice: Trying to get property of non-object in /stable/master/mod/lesson/lib.php on line 472
              

              There are 2 ways to reproduce this:

              1. edit lesson settings.
              2. delete student attempt

              Please feel free to re-send this issue back for peer-review when it is ready.

              Rosie

              Show
              rwijaya Rossiani Wijaya added a comment - Hi Tim, Thank you for providing patch to fix this issue. Some feedback for the patch: On line 473, I think it would be better to add a check and make sure that $grades is not null. Do the same check for line 474 for $grade->items. When I tested this, I got the following warning and notice: Warning: reset() expects parameter 1 to be array, null given in /stable/master/mod/lesson/lib.php on line 472 Notice: Trying to get property of non-object in /stable/master/mod/lesson/lib.php on line 472 There are 2 ways to reproduce this: edit lesson settings. delete student attempt Please feel free to re-send this issue back for peer-review when it is ready. Rosie
              Hide
              tlock Tim Lock added a comment -

              Updated branches per PR.

              Show
              tlock Tim Lock added a comment - Updated branches per PR.
              Hide
              rwijaya Rossiani Wijaya added a comment -

              Hi Tim,

              The following error still occurs when deleting student attempt (student has only one attempt).

              Notice: Trying to get property of non-object in /stable/master/mod/lesson/lib.php on line 474 
              


              Please feel free to re-send this issue back for peer-review when it is ready.

              Thanks

              Show
              rwijaya Rossiani Wijaya added a comment - Hi Tim, The following error still occurs when deleting student attempt (student has only one attempt). Notice: Trying to get property of non-object in /stable/master/mod/lesson/lib.php on line 474 Please feel free to re-send this issue back for peer-review when it is ready. Thanks
              Hide
              tlock Tim Lock added a comment -

              Updated branches per PR.

              Show
              tlock Tim Lock added a comment - Updated branches per PR.
              Hide
              rwijaya Rossiani Wijaya added a comment -

              Hi Tim,

              Thank you for fixing this. It works great now.

              I'm submitting this for integration review.

              Show
              rwijaya Rossiani Wijaya added a comment - Hi Tim, Thank you for fixing this. It works great now. I'm submitting this for integration review.
              Hide
              poltawski Dan Poltawski added a comment -

              Hi Tim,

              It seems a bit excessive to have 3 commits for these changes - would you mind if I squashed these into one?

              Show
              poltawski Dan Poltawski added a comment - Hi Tim, It seems a bit excessive to have 3 commits for these changes - would you mind if I squashed these into one?
              Hide
              poltawski Dan Poltawski added a comment -

              Since Tim didn't respond and I wanted to get this into testing today I integrated it as is.

              Show
              poltawski Dan Poltawski added a comment - Since Tim didn't respond and I wanted to get this into testing today I integrated it as is.
              Hide
              ankit_frenz Ankit Agarwal added a comment - - edited

              Am getting

               '****' not '*' 

              in the grades when I answer all questions correctly, seems fine to me, however the testing instructions say otherwise. Will wait for a confirmation on this from Rosie or Tim before proceeding.

              Show
              ankit_frenz Ankit Agarwal added a comment - - edited Am getting '****' not '*' in the grades when I answer all questions correctly, seems fine to me, however the testing instructions say otherwise. Will wait for a confirmation on this from Rosie or Tim before proceeding.
              Hide
              tlock Tim Lock added a comment -

              Hi Ankit,

              Let me have a look. I can re-write this branch if you want in the process?

              Show
              tlock Tim Lock added a comment - Hi Ankit, Let me have a look. I can re-write this branch if you want in the process?
              Hide
              ankit_frenz Ankit Agarwal added a comment -

              Hi Tim,
              It is already integrated, so there is no need to make changes to the branch. Just a confirmation on the instructions would be great.

              Cheers

              Show
              ankit_frenz Ankit Agarwal added a comment - Hi Tim, It is already integrated, so there is no need to make changes to the branch. Just a confirmation on the instructions would be great. Cheers
              Hide
              tlock Tim Lock added a comment -

              Found branches missing, so re-built as one commit

              Show
              tlock Tim Lock added a comment - Found branches missing, so re-built as one commit
              Hide
              tlock Tim Lock added a comment -

              Hi Ankit,

              I've just tested with my scale of 5, 2 questions. None right, I get 1 *. Two right, I get 5 *'s.

              Show
              tlock Tim Lock added a comment - Hi Ankit, I've just tested with my scale of 5, 2 questions. None right, I get 1 *. Two right, I get 5 *'s.
              Hide
              ankit_frenz Ankit Agarwal added a comment -

              Thanks for the clarification Tim, this works as described.
              Thanks

              Show
              ankit_frenz Ankit Agarwal added a comment - Thanks for the clarification Tim, this works as described. Thanks
              Hide
              poltawski Dan Poltawski added a comment -

              Thanks for your contributions, this change is now upstream!

              “ If debugging is the process of removing software bugs, then programming must be the process of putting them in. ” - Edsger Dijkstra

              Show
              poltawski Dan Poltawski added a comment - Thanks for your contributions, this change is now upstream! “ If debugging is the process of removing software bugs, then programming must be the process of putting them in. ” - Edsger Dijkstra

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    13/Jan/14