Moodle
  1. Moodle
  2. MDL-16431

Custom scales displaying instead of site-wide scales when creating "Grade Items" in 1.9

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.2
    • Fix Version/s: 1.9.5
    • Component/s: Gradebook
    • Labels:
      None
    • Environment:
      Moodle 1.9.2
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      31134

      Description

      By default, individual course scales should not be accessible to other users on the site unless they've been designated a site-wide "standard" scale, which is something only admins can do.

      However, we've discovered that if you create a Grade Item (via Grades > Choose an Action > Categories & Items > Add Grade Item) and click on the "Scale" drop down menu, you see all the custom scales available on the site.

      The steps to recreate are:

      1) Create a custom scale for Course A as Teacher A
      2) Assign that scale to a grade item in Course A.
      3) Create a grade item in Course B as Teacher B
      4) Add a grade item, and look at the scale menu; if the bug is there, then you'll be able to see the custom scale that should have been limited to to just Course A.

      In looking through the code, I discovered the problem lies on line 60:

      if ($scales = get_records('scale')) {

      This query returns every scale in Moodle, both custom and site-wide, rather than just those for the course.

        Activity

        Hide
        Steven Breiner added a comment -

        True enough... and potentially very confusing for instructors, since there can be many scales with the same name, and which can be edited only by the instructor who created them (or an admin logged in as the instructor). To compound the issue, the scale's values are not visible anywhere (that I can find) except in the drop-downs in an instructor's view of the gradebook (then only after selecting the scale) and in the creator's scales-editing area - additionally there is no simple way to identify who the creator is.

        So faculty can select scales blindly (i.e., without being able to see what they contain), perhaps choosing different scales by the same name (since there is no indication of what the scale contains), and can't amend them for their own courses. This is pretty sloppy and has a significant potential for causing erroneous grade calculations applied to student scores. (Granted, instructors should actually know how a scale works before using it - but alas, this bug promotes a bad practice).

        Show
        Steven Breiner added a comment - True enough... and potentially very confusing for instructors, since there can be many scales with the same name, and which can be edited only by the instructor who created them (or an admin logged in as the instructor). To compound the issue, the scale's values are not visible anywhere (that I can find) except in the drop-downs in an instructor's view of the gradebook (then only after selecting the scale) and in the creator's scales-editing area - additionally there is no simple way to identify who the creator is. So faculty can select scales blindly (i.e., without being able to see what they contain), perhaps choosing different scales by the same name (since there is no indication of what the scale contains), and can't amend them for their own courses. This is pretty sloppy and has a significant potential for causing erroneous grade calculations applied to student scores. (Granted, instructors should actually know how a scale works before using it - but alas, this bug promotes a bad practice).
        Hide
        Steven Breiner added a comment -

        Just realized... this is a duplicate of Bug MDL-15926 (http://tracker.moodle.org/browse/MDL-15926).

        Show
        Steven Breiner added a comment - Just realized... this is a duplicate of Bug MDL-15926 ( http://tracker.moodle.org/browse/MDL-15926 ).
        Hide
        Paul Grzesina added a comment -

        MDL-15926 seems to be a bit different as it is about forums not the grade book. The following patch to grade/edit/tree/item_form.php did what I wanted for the gradebook. I don't know if this problem shows up elsewhere. The modification will show the standard scales as well as custom scales for the course. (Don't mind the revision numbers, they are for local changes only. In this case 486 is essentially 1.9.0.)

        — item_form.php (revision 486)
        +++ item_form.php (working copy)
        @@ -57,11 +57,16 @@
        //$mform->disabledIf('calculation', 'gradetype', 'eq', GRADE_TYPE_NONE);

        $options = array(0=>get_string('usenoscale', 'grades'));

        • if ($scales = get_records('scale')) {
          + if ($scales = get_records('scale', 'courseid', 0))
          Unknown macro: { foreach ($scales as $scale) { $options[$scale->id] = format_string($scale->name); } }

          + if ($scales = get_records('scale', 'courseid', $COURSE->id))

          Unknown macro: {+ foreach ($scales as $scale) { + $options[$scale->id] = format_string($scale->name); + }+ }

          $mform->addElement('select', 'scaleid', get_string('scale'), $options);
          $mform->setHelpButton('scaleid', array('scaleid', get_string('scaleid', 'grades'), 'grade'), true);
          $mform->disabledIf('scaleid', 'gradetype', 'noteq', GRADE_TYPE_SCALE);

        Show
        Paul Grzesina added a comment - MDL-15926 seems to be a bit different as it is about forums not the grade book. The following patch to grade/edit/tree/item_form.php did what I wanted for the gradebook. I don't know if this problem shows up elsewhere. The modification will show the standard scales as well as custom scales for the course. (Don't mind the revision numbers, they are for local changes only. In this case 486 is essentially 1.9.0.) — item_form.php (revision 486) +++ item_form.php (working copy) @@ -57,11 +57,16 @@ //$mform->disabledIf('calculation', 'gradetype', 'eq', GRADE_TYPE_NONE); $options = array(0=>get_string('usenoscale', 'grades')); if ($scales = get_records('scale')) { + if ($scales = get_records('scale', 'courseid', 0)) Unknown macro: { foreach ($scales as $scale) { $options[$scale->id] = format_string($scale->name); } } + if ($scales = get_records('scale', 'courseid', $COURSE->id)) Unknown macro: {+ foreach ($scales as $scale) { + $options[$scale->id] = format_string($scale->name); + }+ } $mform->addElement('select', 'scaleid', get_string('scale'), $options); $mform->setHelpButton('scaleid', array('scaleid', get_string('scaleid', 'grades'), 'grade'), true); $mform->disabledIf('scaleid', 'gradetype', 'noteq', GRADE_TYPE_SCALE);
        Hide
        Petr Škoda added a comment -

        fixed a few days ago, thanks for the report

        Show
        Petr Škoda added a comment - fixed a few days ago, thanks for the report
        Hide
        Sam Hemelryk added a comment -

        Tested and confirmed fixed. Thanks

        Show
        Sam Hemelryk added a comment - Tested and confirmed fixed. Thanks

          People

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

            Dates

            • Created:
              Updated:
              Resolved: