Moodle
  1. Moodle
  2. MDL-38628

New Assignment Module - Gives learners the top grade in a scale

    Details

    • Story Points:
      3
    • Rank:
      53361
    • Sprint:
      FRONTEND Sprint 6

      Description

      Create new scale 'Achieved', 'Not Achieved', 'Not Marked' - Achieved being the most positive
      Create new Assignment Activity
      Use the scale we have just created
      Add activity to your course
      Add learner to your course
      Grade a learner - click on the 'silver cog' in the edit column
      then click 'Grade'
      You will be presented with 'Achieved' highlighted in the grade drop down list, although the 'Current Grade in Gradebook' is set to a '-'
      Do NOT EDIT the grade in this screen, just click save
      Then the grader report updates the table for that learner achieving this activity, even though we have not changed the grade

        Issue Links

          Activity

          Hide
          Damyon Wiese added a comment -

          Thanks for reporting this.

          I've put that on the backlog.

          In the meantime feel free to help us work on this issue. If you are able to provide a patch or links to your Git repository branch, please add a patch label so we will spot it.

          Show
          Damyon Wiese added a comment - Thanks for reporting this. I've put that on the backlog. In the meantime feel free to help us work on this issue. If you are able to provide a patch or links to your Git repository branch, please add a patch label so we will spot it.
          Hide
          CLAIRE BROWNE added a comment -

          HI Damyon,
          We do have a work around for this bug and that is to create new scales and add them to assignments but we have to do some testing because if the grades are already in the gradebook it is hit and miss if a learner gets a downgraded mark or a high mark.

          Show
          CLAIRE BROWNE added a comment - HI Damyon, We do have a work around for this bug and that is to create new scales and add them to assignments but we have to do some testing because if the grades are already in the gradebook it is hit and miss if a learner gets a downgraded mark or a high mark.
          Hide
          Damyon Wiese added a comment -

          Yes thanks Claire, actually I will raise the priority of this because it could lead to unintended changes.

          Show
          Damyon Wiese added a comment - Yes thanks Claire, actually I will raise the priority of this because it could lead to unintended changes.
          Hide
          CLAIRE BROWNE added a comment -

          Also, I do not know who is in charge for the Moodle Docs for scales but someone or if I could needs to update the page with a warning for 2.3 and 2.4 users researching about scales.

          Show
          CLAIRE BROWNE added a comment - Also, I do not know who is in charge for the Moodle Docs for scales but someone or if I could needs to update the page with a warning for 2.3 and 2.4 users researching about scales.
          Hide
          Mary Cooch added a comment - - edited

          Hi Claire. Moodle docs is a wiki and as such anyone can edit and improve them. If you would like to add a comment yourself to http://docs.moodle.org/24/en/Scales and to http://docs.moodle.org/23/en/Scales (different docs for different versions of Moodle) then please feel free to do so If not, then I will happily write something. (Just log in at the top with your Moodle account)

          Show
          Mary Cooch added a comment - - edited Hi Claire. Moodle docs is a wiki and as such anyone can edit and improve them. If you would like to add a comment yourself to http://docs.moodle.org/24/en/Scales and to http://docs.moodle.org/23/en/Scales (different docs for different versions of Moodle) then please feel free to do so If not, then I will happily write something. (Just log in at the top with your Moodle account)
          Hide
          Neil Stapleton added a comment -

          I've voted for this is causing us a major issue following our upgrade to 2.4.1

          If we had any time and resource we'ed try and work on a fix, but we don't at the moment, as CLAIRE BROWN points out the issue with any fix is going to be how it ripples through to the gradebook.

          We certainly have some very frustrated users at the moment ;(

          Show
          Neil Stapleton added a comment - I've voted for this is causing us a major issue following our upgrade to 2.4.1 If we had any time and resource we'ed try and work on a fix, but we don't at the moment, as CLAIRE BROWN points out the issue with any fix is going to be how it ripples through to the gradebook. We certainly have some very frustrated users at the moment ;(
          Hide
          Damyon Wiese added a comment -

          This issue was assigned to me automatically, however 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

          Show
          Damyon Wiese added a comment - This issue was assigned to me automatically, however 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
          Hide
          Jody Steele added a comment -

          The fix for this is fairly simple, just prepend the no grade entry to the grade array.

          Old Code

          mod/assign/locallib.php 5493-5496 (from current master git)
                       } else {
                           $grademenu = make_grades_menu($this->get_instance()->grade);
                           if (count($grademenu) > 0) {
                               $gradingelement = $mform->addElement('select', 'grade', get_string('grade') . ':', $grademenu);
          

          New Code

          mod/assign/locallib.php 5493-5496 (from current master git)
                       } else {
                           $grademenu = array(-1 => get_string("nograde")) + make_grades_menu($this->get_instance()->grade);
                           if (count($grademenu) > 1) {
                               $gradingelement = $mform->addElement('select', 'grade', get_string('grade') . ':', $grademenu);
          

          The count is updated to check against 1 instead of 0 since there is now 1 guaranteed element in the array.

          Show
          Jody Steele added a comment - The fix for this is fairly simple, just prepend the no grade entry to the grade array. Old Code mod/assign/locallib.php 5493-5496 (from current master git) } else { $grademenu = make_grades_menu($ this ->get_instance()->grade); if (count($grademenu) > 0) { $gradingelement = $mform->addElement('select', 'grade', get_string('grade') . ':', $grademenu); New Code mod/assign/locallib.php 5493-5496 (from current master git) } else { $grademenu = array(-1 => get_string( "nograde" )) + make_grades_menu($ this ->get_instance()->grade); if (count($grademenu) > 1) { $gradingelement = $mform->addElement('select', 'grade', get_string('grade') . ':', $grademenu); The count is updated to check against 1 instead of 0 since there is now 1 guaranteed element in the array.
          Hide
          CLAIRE BROWNE added a comment -

          Thanks Jody, this code change has fixed our problem.

          Show
          CLAIRE BROWNE added a comment - Thanks Jody, this code change has fixed our problem.
          Hide
          Jody Steele added a comment - - edited

          Turns out it wasn't so simple. That shows the nograde option in the assign module, but it doesn't allow the user to actually select it (you get an error message saying -1 isn't an option or something of the like.)

          To overcome this, we've made the following 2 changes as well:

          mod/assign/gradeform.php 96-98 (from current master git)
                          $scaleoptions = make_menu_from_list($scale->scale);
                          if (!array_key_exists((int)$data['grade'], $scaleoptions)) {
                              $errors['grade'] = get_string('invalidgradeforscale', 'assign');
          
          mod/assign/gradeform.php 96-98
                          $scaleoptions = make_menu_from_list($scale->scale);
                          if ((int)$data['grade'] !== -1 && !array_key_exists((int)$data['grade'], $scaleoptions)) {
                              $errors['grade'] = get_string('invalidgradeforscale', 'assign');
          
          mod/assign/locallib.php 3880-3883 (from current master git)
                  if ($grade->grade >= 0) {
                      $gradebookgrade['rawgrade'] = $grade->grade;
                  }
                  $gradebookgrade['userid'] = $grade->userid;
          
          mod/assign/locallib.php 3880-3887
                  if ($grade->grade >= 0) {
                      $gradebookgrade['rawgrade'] = $grade->grade;
                  }
                  //allow no grade to be chosen
                  if ($grade->grade == -1) {
                      $gradebookgrade['rawgrade'] = NULL;
                  }
                  $gradebookgrade['userid'] = $grade->userid;
          
          Show
          Jody Steele added a comment - - edited Turns out it wasn't so simple. That shows the nograde option in the assign module, but it doesn't allow the user to actually select it (you get an error message saying -1 isn't an option or something of the like.) To overcome this, we've made the following 2 changes as well: mod/assign/gradeform.php 96-98 (from current master git) $scaleoptions = make_menu_from_list($scale->scale); if (!array_key_exists(( int )$data['grade'], $scaleoptions)) { $errors['grade'] = get_string('invalidgradeforscale', 'assign'); mod/assign/gradeform.php 96-98 $scaleoptions = make_menu_from_list($scale->scale); if (( int )$data['grade'] !== -1 && !array_key_exists(( int )$data['grade'], $scaleoptions)) { $errors['grade'] = get_string('invalidgradeforscale', 'assign'); mod/assign/locallib.php 3880-3883 (from current master git) if ($grade->grade >= 0) { $gradebookgrade['rawgrade'] = $grade->grade; } $gradebookgrade['userid'] = $grade->userid; mod/assign/locallib.php 3880-3887 if ($grade->grade >= 0) { $gradebookgrade['rawgrade'] = $grade->grade; } //allow no grade to be chosen if ($grade->grade == -1) { $gradebookgrade['rawgrade'] = NULL; } $gradebookgrade['userid'] = $grade->userid;
          Hide
          Andrew Davis added a comment -

          Putting this up for peer review.

          Jody, if you are able to provide the URL to a git repository containing your work we can make sure you get credit for providing the fix.

          Show
          Andrew Davis added a comment - Putting this up for peer review. Jody, if you are able to provide the URL to a git repository containing your work we can make sure you get credit for providing the fix.
          Hide
          Jody Steele added a comment - - edited

          Hey Andrew,
          My familiarity with git/github is very low, so I hope I have done this correctly.
          The git information is as follows:

          Pull from Repository: https://github.com/steelej/moodle-1.git
          Pull Master Branch: MDL-38628-assign_missing_nograde
          Pull Master Diff URL: https://github.com/steelej/moodle-1/compare/moodle:master...MDL-38628-assign_missing_nograde
          Pull MOODLE_24_STABLE Branch: MDL-38628-assign_missing_nograde-24_STABLE
          Pull MOODLE_24_STABLE Diff URL: https://github.com/steelej/moodle-1/compare/moodle:MOODLE_24_STABLE...MDL-38628-assign_missing_nograde-24_STABLE

          Is that what you're looking for?

          Show
          Jody Steele added a comment - - edited Hey Andrew, My familiarity with git/github is very low, so I hope I have done this correctly. The git information is as follows: Pull from Repository: https://github.com/steelej/moodle-1.git Pull Master Branch: MDL-38628 -assign_missing_nograde Pull Master Diff URL: https://github.com/steelej/moodle-1/compare/moodle:master...MDL-38628-assign_missing_nograde Pull MOODLE_24_STABLE Branch: MDL-38628 -assign_missing_nograde-24_STABLE Pull MOODLE_24_STABLE Diff URL: https://github.com/steelej/moodle-1/compare/moodle:MOODLE_24_STABLE...MDL-38628-assign_missing_nograde-24_STABLE Is that what you're looking for?
          Hide
          Andrew Davis added a comment -

          Perfect

          I've made two small changes to the master branch you provided which I will backport after this has been through peer review. You don't need to make any further changes.

          For future reference:

          1) I altered an inline php comment to match the Moodle coding style guide. http://docs.moodle.org/dev/Coding_style#Inline_comments

          2) I altered the commit message to include the bug number and the component. http://docs.moodle.org/dev/Coding_style#Git_commits

          Show
          Andrew Davis added a comment - Perfect I've made two small changes to the master branch you provided which I will backport after this has been through peer review. You don't need to make any further changes. For future reference: 1) I altered an inline php comment to match the Moodle coding style guide. http://docs.moodle.org/dev/Coding_style#Inline_comments 2) I altered the commit message to include the bug number and the component. http://docs.moodle.org/dev/Coding_style#Git_commits
          Hide
          Rajesh Taneja added a comment -

          Thanks Jody and Andrew,

          Patch looks spot-on, but I think Damyon should have his +1 before it gets any further.

          Show
          Rajesh Taneja added a comment - Thanks Jody and Andrew, Patch looks spot-on, but I think Damyon should have his +1 before it gets any further.
          Hide
          Damyon Wiese added a comment -

          This patch looks fine to me.

          But - because the grading API is not clear here - I checked to see how other places that use make_grade_menu handle this and I think it needs checking across the board.

          My look shows:

          • workshop already seems to have the same workaround
          • but ratings doesn't
          • old assignment does
          • it doesn't look like advanced grading does (but maybe I didn't look close enough)

          So my +1 as long as we follow up these other areas.

          Show
          Damyon Wiese added a comment - This patch looks fine to me. But - because the grading API is not clear here - I checked to see how other places that use make_grade_menu handle this and I think it needs checking across the board. My look shows: workshop already seems to have the same workaround but ratings doesn't old assignment does it doesn't look like advanced grading does (but maybe I didn't look close enough) So my +1 as long as we follow up these other areas.
          Hide
          Andrew Davis added a comment -

          I've raised MDL-42419 to revisit this behaviour and make_grade_menu(). Submitting for integration.

          Show
          Andrew Davis added a comment - I've raised MDL-42419 to revisit this behaviour and make_grade_menu(). Submitting for integration.
          Hide
          Dan Poltawski added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Dan Poltawski added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Andrew Davis added a comment -

          Rebased.

          Show
          Andrew Davis added a comment - Rebased.
          Hide
          Marina Glancy added a comment -

          Thanks, integrated in 2.4, 2.5 and 2.6

          Jody, note that I changed commits during integration to remove the trailing whitespaces

          Show
          Marina Glancy added a comment - Thanks, integrated in 2.4, 2.5 and 2.6 Jody, note that I changed commits during integration to remove the trailing whitespaces
          Hide
          Jason Fowler added a comment -

          Thanks Andrew, works as described.

          Show
          Jason Fowler added a comment - Thanks Andrew, works as described.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          "Aequam memento rebus in arduis servare mentem"

          Many thanks for your hard work, this is now part of "Moodle, the LMS". Closing!

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - "Aequam memento rebus in arduis servare mentem" Many thanks for your hard work, this is now part of "Moodle, the LMS". Closing! Ciao

            People

            • Votes:
              8 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Agile