Moodle
  1. Moodle
  2. MDL-22847

Can't delete quiz attempts when specific group is selected

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.9.9
    • Fix Version/s: 1.9.10
    • Component/s: Quiz
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      26189

      Description

      After updating to Moodle 1.9.9 I found out that I lose ability to delete quiz attempts (even as admin,tested on different browsers).

      1. Select quiz report, then use group combobox to choose attempts from one specific group
      2. Mark an attempt on quiz report
      3. Choose "delete selected attempts", than "yes"
      4. Look at reloaded report - the attempt are intact

      It will work normally if you select "all groups" mode.
      Apparently group mode selection combo box interferes somehow with new session check.

        Activity

        Hide
        Tim Hunt added a comment -

        One of the security fixes in 1.9.9 was adding sesskey checks to this code to stop cross-site request forgery.

        I have just tested again on my development server, and I can still delete quiz attempts.

        Can you do some debugging to work out why it is not working on your server?

        Show
        Tim Hunt added a comment - One of the security fixes in 1.9.9 was adding sesskey checks to this code to stop cross-site request forgery. I have just tested again on my development server, and I can still delete quiz attempts. Can you do some debugging to work out why it is not working on your server?
        Hide
        Oleg Sychev added a comment -

        I too can delete quiz attempts on my development server, but not on the production one Debugging on the production server is somewhat problematic, but I'll see what I could do (any pointers would be good). I could change code in a way that doesn't hurt production (there are many exams currently held using these quizzes), but haven't direct database access on production server.

        The problem is definitely independent from the client software, since it persists regardless of browser (from IE6 to Google Chrome) or connection (local network or internet).

        One thing: did you try to do this on development server connecting to it over network? My development server is accessible from local computer only...

        Show
        Oleg Sychev added a comment - I too can delete quiz attempts on my development server, but not on the production one Debugging on the production server is somewhat problematic, but I'll see what I could do (any pointers would be good). I could change code in a way that doesn't hurt production (there are many exams currently held using these quizzes), but haven't direct database access on production server. The problem is definitely independent from the client software, since it persists regardless of browser (from IE6 to Google Chrome) or connection (local network or internet). One thing: did you try to do this on development server connecting to it over network? My development server is accessible from local computer only...
        Hide
        Tim Hunt added a comment -

        Yes my dev server is on the network.

        Can you create a test quiz on the live server?

        Show
        Tim Hunt added a comment - Yes my dev server is on the network. Can you create a test quiz on the live server?
        Hide
        Oleg Sychev added a comment -

        I think I catched it's tail.

        Set visible or separate group mode. If you select "all groups" you can delete attempts. If you select specific group you can't. Could you try this?

        Show
        Oleg Sychev added a comment - I think I catched it's tail. Set visible or separate group mode. If you select "all groups" you can delete attempts. If you select specific group you can't. Could you try this?
        Hide
        Oleg Sychev added a comment -

        More precise problem description added.

        Show
        Oleg Sychev added a comment - More precise problem description added.
        Hide
        Tim Hunt added a comment -

        Got it.

        if ($groupstudents && !in_array($attempt->userid, $groupstudents)) {

        is wong. The student ids are in the array keys of $groupstudents, not in the values, so it needs to be array_key_exists, not in_array.

        I'm about to commit a fix.

        Show
        Tim Hunt added a comment - Got it. if ($groupstudents && !in_array($attempt->userid, $groupstudents)) { is wong. The student ids are in the array keys of $groupstudents, not in the values, so it needs to be array_key_exists, not in_array. I'm about to commit a fix.
        Hide
        Tim Hunt added a comment -

        Thanks Oleg.

        Show
        Tim Hunt added a comment - Thanks Oleg.
        Hide
        Oleg Sychev added a comment -

        Yes, now it works.

        Thanks, Tim.

        Show
        Oleg Sychev added a comment - Yes, now it works. Thanks, Tim.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: