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 2.6 Branch:
      mdl43020-moodle26
    • 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

          Issue Links

            Activity

            Hide
            Michael de Raadt added a comment -

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

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

            Thanks for reporting this and providing a patch.

            Show
            Michael de Raadt added a comment - Thanks for reporting this and providing a patch.
            Hide
            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
            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
            Tim Lock added a comment -

            Updated branches per PR.

            Show
            Tim Lock added a comment - Updated branches per PR.
            Hide
            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
            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
            Tim Lock added a comment -

            Updated branches per PR.

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

            Hi Tim,

            Thank you for fixing this. It works great now.

            I'm submitting this for integration review.

            Show
            Rossiani Wijaya added a comment - Hi Tim, Thank you for fixing this. It works great now. I'm submitting this for integration review.
            Hide
            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
            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
            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
            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 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 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
            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
            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 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 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
            Tim Lock added a comment -

            Found branches missing, so re-built as one commit

            Show
            Tim Lock added a comment - Found branches missing, so re-built as one commit
            Hide
            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
            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 Agarwal added a comment -

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

            Show
            Ankit Agarwal added a comment - Thanks for the clarification Tim, this works as described. Thanks
            Hide
            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
            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: