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

Add option to show/hide suspended users in grader report

    Details

    • Testing Instructions:
      Hide

      Prerequisite

      1. Course with min. one activity
      2. Few enrolled students with some suspended enrolment, and some with expired enrolments.

      Test 1

      1. Go to Grader report preference (Grade administration -> My report preferences -> Grader report)
      2. Set "Show only active enrolments" to Yes
      3. You should only see grades of active students (and not suspended users.)

      Test 2

      1. Go to Grader report preference (Grade administration -> My report preferences -> Grader report)
      2. Set "Show only active enrolments" to No
      3. You should only see grades of active and suspended (Greyed name) students.

      Test 4:

      1. Export grades (in all formats ods/xls/txt) with "Exclude suspended users" unchecked and make sure you see one more column "suspended" with appropriate "yes" value showing user enrolment status.
      2. Try exporting again with "Exclude suspended users" checked and you should only get grades for active users. Also suspended column should not be in export file.

      Test 5:

      1. Log in as admin
      2. Remove course:viewsuspendedusers capability for editing teacher
      3. Log in as editing teacher, and try Test 1, 2, 3 and 4 and make sure you can't show/hide/export suspended users.
      Show
      Prerequisite Course with min. one activity Few enrolled students with some suspended enrolment, and some with expired enrolments. Test 1 Go to Grader report preference (Grade administration -> My report preferences -> Grader report) Set "Show only active enrolments" to Yes You should only see grades of active students (and not suspended users.) Test 2 Go to Grader report preference (Grade administration -> My report preferences -> Grader report) Set "Show only active enrolments" to No You should only see grades of active and suspended (Greyed name) students. Test 4: Export grades (in all formats ods/xls/txt) with "Exclude suspended users" unchecked and make sure you see one more column "suspended" with appropriate "yes" value showing user enrolment status. Try exporting again with "Exclude suspended users" checked and you should only get grades for active users. Also suspended column should not be in export file. Test 5: Log in as admin Remove course:viewsuspendedusers capability for editing teacher Log in as editing teacher, and try Test 1, 2, 3 and 4 and make sure you can't show/hide/export suspended users.
    • Workaround:
      Hide

      change the code to something like -

      line 339,340 you'll see a comment that it wants to limit users with an active enrollment.

      Yet to do that, you would want something more like

      list($enrolledsql, $enrolledparams) = get_enrolled_sql($this->context,'',0,1);

      Show
      change the code to something like - line 339,340 you'll see a comment that it wants to limit users with an active enrollment. Yet to do that, you would want something more like list($enrolledsql, $enrolledparams) = get_enrolled_sql($this->context,'',0,1);
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull Master Branch:
      wip-mdl-31969

      Description

      When you go into the grader report, you will see suspended users (with the suspend icon).
      I don't believe it is the intent of the report to do that per the comments in the file
      (see the comment below on "//limit to users with an active enrollment")

      moodle / grade / report / grader / lib.php

      //limit to users with an active enrollment
      list($enrolledsql, $enrolledparams) = get_enrolled_sql($this->context);
      

      line 339,340 you'll see a comment that it wants to limit users with an active enrollment.

      Yet to do that, you would want something more like -

      list($enrolledsql, $enrolledparams) = get_enrolled_sql($this->context,'',0,1);
      

      get_enrolled_sql is in lib/accesslib.php

      function get_enrolled_sql(context $context, $withcapability = '', $groupid = 0, $onlyactive = false) {
      

        1. note onlyactive is set to false by default.

      Replication steps:

      1. in a course with users,
      2. go into Course administration -> users -> enrolled users
      3. click on the edit icon on the enrollment method column of one user and change user to suspended.
      4. now go into the gradebook, you will see the user, but there will be the pause/suspend icon.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

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