Moodle
  1. Moodle
  2. MDL-13831

Grade to pass can't be set from update activity screen

    Details

    • Type: Improvement Improvement
    • Status: Development in progress
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.9, 2.4.2
    • Fix Version/s: DEV backlog
    • Component/s: Gradebook
    • Labels:
    • Rank:
      4204

      Description

      The current way of setting it is a bit obscure and I think it should really be available on all the 'update this activity' pages.

        Issue Links

          Activity

          Hide
          Ray Morris added a comment -

          It really would be nice to be able to set "passing" grade within the Grade section when you create or edit an activity. I may be willing to code this if there is agreement that it's a desired improvement and it would, properly coded, be accepted into mainline.

          Show
          Ray Morris added a comment - It really would be nice to be able to set "passing" grade within the Grade section when you create or edit an activity. I may be willing to code this if there is agreement that it's a desired improvement and it would, properly coded, be accepted into mainline.
          Hide
          Davo Smith added a comment -

          Not free to tidy this up properly, but this patch was working last time I tried it:

          ------------------------------ course/modedit.php ------------------------------
          index 56bf28a..5b38259 100644
          @@ -215,10 +215,16 @@ if (!empty($add))

          { // do not set if mixed categories present $data->gradecat = $gradecat; }

          }

          + $item = grade_item::fetch(array('itemtype'=>'mod', 'itemmodule'=>$data->modulename,
          + 'iteminstance'=>$data->instance, 'courseid'=>$course->id));
          + if (!empty($item->gradepass))

          { + $data->gradepass = $item->gradepass; + }

          +
          $sectionname = get_section_name($course, $cw);
          $fullmodulename = get_string('modulename', $module->name);

          if ($data->section && $course->format != 'site') {
          $heading = new stdClass();
          @@ 517,10 +523,14 @@ if ($mform>is_cancelled()) {
          'iteminstance'=>$fromform->instance, 'itemnumber'=>0, 'courseid'=>$course->id))) {
          if ($grade_item->idnumber != $fromform->cmidnumber)

          { $grade_item->idnumber = $fromform->cmidnumber; $grade_item->update(); }

          + if ($grade_item->gradepass != $fromform->gradepass)

          { + $grade_item->gradepass = $fromform->gradepass; + $grade_item->update(); + }

          }

          $items = grade_item::fetch_all(array('itemtype'=>'mod', 'itemmodule'=>$fromform->modulename,
          'iteminstance'=>$fromform->instance, 'courseid'=>$course->id));

          -------------------------- course/moodleform_mod.php --------------------------
          index b4feb9d..afc7862 100644
          @@ -756,10 +756,15 @@ abstract class moodleform_mod extends moodleform {

          //if supports grades and grades arent being handled via ratings
          if (!$this->_features->rating)

          { $mform->addElement('modgrade', 'grade', get_string('grade')); $mform->setDefault('grade', 100); + + $mform->addElement('text', 'gradepass', get_string('gradepass', 'grades')); + $mform->setDefault('gradepass', ''); + $mform->setType('gradepass', PARAM_FLOAT); + $mform->setAdvanced('gradepass', true); }

          if ($this->_features->advancedgrading
          and !empty($this->current->_advancedgradingdata['methods'])
          and !empty($this->current->_advancedgradingdata['areas'])) {

          Show
          Davo Smith added a comment - Not free to tidy this up properly, but this patch was working last time I tried it: ------------------------------ course/modedit.php ------------------------------ index 56bf28a..5b38259 100644 @@ -215,10 +215,16 @@ if (!empty($add)) { // do not set if mixed categories present $data->gradecat = $gradecat; } } + $item = grade_item::fetch(array('itemtype'=>'mod', 'itemmodule'=>$data->modulename, + 'iteminstance'=>$data->instance, 'courseid'=>$course->id)); + if (!empty($item->gradepass)) { + $data->gradepass = $item->gradepass; + } + $sectionname = get_section_name($course, $cw); $fullmodulename = get_string('modulename', $module->name); if ($data->section && $course->format != 'site') { $heading = new stdClass(); @@ 517,10 +523,14 @@ if ($mform >is_cancelled()) { 'iteminstance'=>$fromform->instance, 'itemnumber'=>0, 'courseid'=>$course->id))) { if ($grade_item->idnumber != $fromform->cmidnumber) { $grade_item->idnumber = $fromform->cmidnumber; $grade_item->update(); } + if ($grade_item->gradepass != $fromform->gradepass) { + $grade_item->gradepass = $fromform->gradepass; + $grade_item->update(); + } } $items = grade_item::fetch_all(array('itemtype'=>'mod', 'itemmodule'=>$fromform->modulename, 'iteminstance'=>$fromform->instance, 'courseid'=>$course->id)); -------------------------- course/moodleform_mod.php -------------------------- index b4feb9d..afc7862 100644 @@ -756,10 +756,15 @@ abstract class moodleform_mod extends moodleform { //if supports grades and grades arent being handled via ratings if (!$this->_features->rating) { $mform->addElement('modgrade', 'grade', get_string('grade')); $mform->setDefault('grade', 100); + + $mform->addElement('text', 'gradepass', get_string('gradepass', 'grades')); + $mform->setDefault('gradepass', ''); + $mform->setType('gradepass', PARAM_FLOAT); + $mform->setAdvanced('gradepass', true); } if ($this->_features->advancedgrading and !empty($this->current->_advancedgradingdata ['methods'] ) and !empty($this->current->_advancedgradingdata ['areas'] )) {
          Hide
          Davo Smith added a comment -

          Actually, that didn't copy + paste very well, so I've attached it as a text file instead.

          Note it probably can't be applied automatically, but it's simple enough to be possible to copy + paste manually.

          Show
          Davo Smith added a comment - Actually, that didn't copy + paste very well, so I've attached it as a text file instead. Note it probably can't be applied automatically, but it's simple enough to be possible to copy + paste manually.
          Hide
          Paula Clough added a comment -

          Having the setting within the assignment would make this feature much more easily used by Instructors. It would also make it easier to check what has happened when we get the call that says... the student only got 70% and it's marking them as passed.
          Thanks,
          Paula

          Show
          Paula Clough added a comment - Having the setting within the assignment would make this feature much more easily used by Instructors. It would also make it easier to check what has happened when we get the call that says... the student only got 70% and it's marking them as passed. Thanks, Paula
          Hide
          Davo Smith added a comment -

          Patch submitted for peer review.

          I can see a lot of benefit in having this option on the settings page, but at the same time I'm more than happy for this implementation to be struck down as not being suitable (for example, I don't think it works well with grading scales, but then it is no different from the same setting when accessed directly through the gradebook).

          Show
          Davo Smith added a comment - Patch submitted for peer review. I can see a lot of benefit in having this option on the settings page, but at the same time I'm more than happy for this implementation to be struck down as not being suitable (for example, I don't think it works well with grading scales, but then it is no different from the same setting when accessed directly through the gradebook).
          Hide
          Tim Hunt added a comment -

          Thanks for doing this Davo.

          If this is the same UI as in the gradebook, then it is good enough for now, even if both should be improved later.

          Note that PARAM_FLOAT is problematic. It accepts a PHP-formatted float, like 0.1. Europeans and many others would more naturally write 0,1. However, this is a global problem, and I think from previous discussion with Petr, it is only fixable be creating a new float formslib field type.

          My remaining worry is, what about a module like Workshop, where one activity has two associated grade items? I can't work out what this code will do.

          Actually, it would be good if you wrote some testing instructions. That would make it quick and easy for lazy people like me to see how it is supposed to behave.

          Show
          Tim Hunt added a comment - Thanks for doing this Davo. If this is the same UI as in the gradebook, then it is good enough for now, even if both should be improved later. Note that PARAM_FLOAT is problematic. It accepts a PHP-formatted float, like 0.1. Europeans and many others would more naturally write 0,1. However, this is a global problem, and I think from previous discussion with Petr, it is only fixable be creating a new float formslib field type. My remaining worry is, what about a module like Workshop, where one activity has two associated grade items? I can't work out what this code will do. Actually, it would be good if you wrote some testing instructions. That would make it quick and easy for lazy people like me to see how it is supposed to behave.
          Hide
          Davo Smith added a comment -

          Tim - given the number of free evenings I have before flying to Dublin (0), maybe it's something to look at during Thursday's hackfest?

          Show
          Davo Smith added a comment - Tim - given the number of free evenings I have before flying to Dublin (0), maybe it's something to look at during Thursday's hackfest?
          Hide
          Tim Hunt added a comment -

          Sure.

          Show
          Tim Hunt added a comment - Sure.
          Hide
          Ray Morris added a comment - - edited

          > My remaining worry is, what about a module like Workshop, where one activity has two
          > associated grade items? I can't work out what this code will do.

          I believe the module can set which grade should be used. By default the first grade is used. (Grade #0).
          See course_modules.completiongradeitemnumber

          Show
          Ray Morris added a comment - - edited > My remaining worry is, what about a module like Workshop, where one activity has two > associated grade items? I can't work out what this code will do. I believe the module can set which grade should be used. By default the first grade is used. (Grade #0). See course_modules.completiongradeitemnumber
          Hide
          Ray Morris added a comment - - edited

          The patch as currently posted may at times throw an error when grade_item::fetch sees more than one row:

          Debug info: 
          Error code: morethanonerecordinfetch
          Stack trace:
          line 467 of \lib\setuplib.php: moodle_exception thrown
          line 163 of \lib\grade\grade_object.php: call to print_error()
          line 326 of \lib\grade\grade_item.php: call to grade_object::fetch_helper()
          line 220 of \course\modedit.php: call to grade_item::fetch()
          

          I haven't yet looked in to it in detail.

          Show
          Ray Morris added a comment - - edited The patch as currently posted may at times throw an error when grade_item::fetch sees more than one row: Debug info: Error code: morethanonerecordinfetch Stack trace: line 467 of \lib\setuplib.php: moodle_exception thrown line 163 of \lib\grade\grade_object.php: call to print_error() line 326 of \lib\grade\grade_item.php: call to grade_object::fetch_helper() line 220 of \course\modedit.php: call to grade_item::fetch() I haven't yet looked in to it in detail.
          Hide
          Tim Hunt added a comment -

          So, it looks like there are some issues to sort out Davo. Are you likely to get a chance to work on this some more?

          Show
          Tim Hunt added a comment - So, it looks like there are some issues to sort out Davo. Are you likely to get a chance to work on this some more?
          Hide
          Davo Smith added a comment -

          Possibly, but not quite sure when - I've got quite a bit to do just at the moment.

          Show
          Davo Smith added a comment - Possibly, but not quite sure when - I've got quite a bit to do just at the moment.
          Hide
          Rob Monk added a comment - - edited

          Here here. What a good feature.
          Surely, if in the Assignment setting screen we can set the Gradebook category, we should be able to set a passing grade.
          And I want a check box that says "Add to progress bar" as well.
          A one stop assignment shop.
          At the moment the work flow is. Set the assignment. Get into Gradebook > Categories and Items > Edit settings of the task to set a pass mark (Annoyingly fiddley). Get into the progress bar settings to Add the task to the progress bar selecting "Passed" as the criteria for completion. So I have to go to Assignment and Gradebook and Progress Bar just to set one task. YUK.
          All this should be able to be done in the one spot when setting the assignment!!

          Show
          Rob Monk added a comment - - edited Here here. What a good feature. Surely, if in the Assignment setting screen we can set the Gradebook category, we should be able to set a passing grade. And I want a check box that says "Add to progress bar" as well. A one stop assignment shop. At the moment the work flow is. Set the assignment. Get into Gradebook > Categories and Items > Edit settings of the task to set a pass mark (Annoyingly fiddley). Get into the progress bar settings to Add the task to the progress bar selecting "Passed" as the criteria for completion. So I have to go to Assignment and Gradebook and Progress Bar just to set one task. YUK. All this should be able to be done in the one spot when setting the assignment!!

            People

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

              Dates

              • Created:
                Updated: