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

Mod/Assign add_grade_form_elements missing hidden param userid

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.9.3, 3.0, 3.1
    • Fix Version/s: 3.0.5
    • Component/s: Assignment
    • Testing Instructions:
      Hide

      Pre test setup

      1. Create a course and add an assignment activity
      2. Enrol 2 or more users (ideally a few more) in the course

      Test v3.0 and v2.9

      1. Log in as admin
      2. Navigate to the assignment activity
      3. Click "View/grade all submissions"
      4. Grade the first student by clicking the grade icon (or selecting edit > grade)
      5. Confirm that you're taken to the grading page and the student matches the one you selected
      6. Confirm that the grading form shows the current student count and where you are in the list, e.g. Grading student: 1 out of 10
      7. Enter a grade for the student and click "Save and show next"
      8. Confirm you are taken to the next student in the list and the position in the list has changed, e.g. Grading student: 2 out of 10
      9. Use the previous button to return to the previous user and verify the grade has been updated
      10. Use the next button to go to the next user in the list
      11. Remove the "rownum" and "useridlistid" params from the URL and add "userid" and set the value to the id of the user you're currently viewing and then hit enter to reload the page
        • You can get the current user's id from the URL in the link on their name at the top of the grading page
      12. Confirm that the user is the same user as before (the one that matches the id)
      13. Confirm that you no longer see a student count, e.g. Grading student: 2 out of 10 has disappeared
      14. Confirm that you don't see "next" or "prev" buttons any more
      15. Enter a grade for the user and click "Save changes"
      16. Return to the list of all students (from step 3) and confirm that the grades were successfully saves for the students

      Test master - old grading interface

      1. Log in as admin
      2. Navigate to the assignment activity
      3. Click "View all submissions"
      4. Repeat instructions from "Test v3.0 and v2.9" from step 4, however to grade a student with the older interface you must use "edit > grade" as the grade icon/button will now take you to the new interface (if MDL-53916 is integrated you will have to revert it).

      Test master - new grading interface

      1. Log in as admin
      2. Navigate to the assignment activity
      3. Click "View all submissions"
      4. Click the "Grade" button next to a user
      5. Confirm that you are taken to the new grading interface and the correct user is loaded
      6. Enter a grade for the user and save it
      7. Navigate forwards/backwards to different users and grade a few more users
      8. Return to the list of users (step 3) and confirm that all of the grades were saved correctly
      Show
      Pre test setup Create a course and add an assignment activity Enrol 2 or more users (ideally a few more) in the course Test v3.0 and v2.9 Log in as admin Navigate to the assignment activity Click "View/grade all submissions" Grade the first student by clicking the grade icon (or selecting edit > grade) Confirm that you're taken to the grading page and the student matches the one you selected Confirm that the grading form shows the current student count and where you are in the list, e.g. Grading student: 1 out of 10 Enter a grade for the student and click "Save and show next" Confirm you are taken to the next student in the list and the position in the list has changed, e.g. Grading student: 2 out of 10 Use the previous button to return to the previous user and verify the grade has been updated Use the next button to go to the next user in the list Remove the "rownum" and "useridlistid" params from the URL and add "userid" and set the value to the id of the user you're currently viewing and then hit enter to reload the page You can get the current user's id from the URL in the link on their name at the top of the grading page Confirm that the user is the same user as before (the one that matches the id) Confirm that you no longer see a student count, e.g. Grading student: 2 out of 10 has disappeared Confirm that you don't see "next" or "prev" buttons any more Enter a grade for the user and click "Save changes" Return to the list of all students (from step 3) and confirm that the grades were successfully saves for the students Test master - old grading interface Log in as admin Navigate to the assignment activity Click "View all submissions" Repeat instructions from "Test v3.0 and v2.9" from step 4, however to grade a student with the older interface you must use "edit > grade" as the grade icon/button will now take you to the new interface (if MDL-53916 is integrated you will have to revert it). Test master - new grading interface Log in as admin Navigate to the assignment activity Click "View all submissions" Click the "Grade" button next to a user Confirm that you are taken to the new grading interface and the correct user is loaded Enter a grade for the user and save it Navigate forwards/backwards to different users and grade a few more users Return to the list of users (step 3) and confirm that all of the grades were saved correctly
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE
    • Pull Master Branch:
      MDL-52133-master

      Description

      In mod/assign/locallib.php function add_grade_form_elements is missing param userid. This function should respect optional param userid.
      For example:
      You can normaly browse link like to view info about student submission http://xxx.xxx.xxx.xxx/mod/assign/view.php?id=500&userid=460&rownum=0&action=grade
      But your atempt to grade student will fail, because add_grade_form_elements doesn't respect param userid for savegrade, while function process_save_grade can work with that optional param.

      Solution: add 2 lines to mod/assign/locallib.php (currently on line 6229):

      $mform->addElement('hidden', 'userid', $userid);
      $mform->setType('userid', PARAM_INT);

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Jul/16