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

limit of responses at module choice fail at synchronous submissions

    Details

    • Testing Instructions:
      Hide

      Setup:

      • course with atleast 2 students (or admin enrolled in course and a student)
      • make a 'choice' with the following settings changed.
        • Options:
          • Limit the number of responses allowed -> Yes
          • Option 1: anything here, Limit 1
          • Option #: anything here, Limit 1 (make as many options as you want)
        • Results:
          • Publish results -> Always show results to students
          • Privacy of results -> Publish full results, showing names and their choices

      Test One:

      • Go to the Choice as Student 1 and select Option 1 DONT HIT "SAVE MY CHOICE"
      • Open an incognito tab (or new browser) and login as Student 2 and selection Option 1 as well. Again, not saving it.
      • Go into mod/choice/lib.php and place sleep(10); after the lock is used 272.
      • Submit student ones choice.
      • Remove the sleep.
      • Submit student two's choice.

      Expected The first student to save the result successfully. The second student will display an notification error "The choice is full and there are no available places"

      Test Two:

      • Same setup as above, make sure the answers for the choices are cleared for students one and two.
      • Go into mod/choice/lib.php and place sleep(10); after the the insert, but before the lock is released. (Line 391 is good)
      • Submit student ones choice.
      • Remove the sleep.
      • Submit student two's choice.

      Expected The first student to save the result successfully. The second student will display an notification error "The choice is full and there are no available places"

      Test Three:

      • In adding the locks I've moved the placing of the event recording. Ensure the Course logs report the correct events have occurred and been logged.
      • Where? Course Admin ► Reports / ► Logs.
      • Example:

        18 Feb, 07:47	Admin User	-	Choice: TESTING	Choice	Choice made	The user with id '2' made the choice with id '1' in the choice activity with course module id '6'.	web	172.XXX.XXX.XXX

      Other testing:

      • Relevant unit tests:

        vendor/bin/phpunit mod/choice/tests/events_test.php

      • Play around with submitting random options and deleting them to make sure nothing has been broken.
      • Are there cases where the lock isn't released properly? (exceptions etc, specifically the print_error calls)
      • Timeouts reached under a reasonable load?
      Show
      Setup: course with atleast 2 students (or admin enrolled in course and a student) make a 'choice' with the following settings changed. Options: Limit the number of responses allowed -> Yes Option 1: anything here, Limit 1 Option #: anything here, Limit 1 (make as many options as you want) Results: Publish results -> Always show results to students Privacy of results -> Publish full results, showing names and their choices Test One: Go to the Choice as Student 1 and select Option 1 DONT HIT "SAVE MY CHOICE" Open an incognito tab (or new browser) and login as Student 2 and selection Option 1 as well. Again, not saving it. Go into mod/choice/lib.php and place sleep(10); after the lock is used 272. Submit student ones choice. Remove the sleep. Submit student two's choice. Expected The first student to save the result successfully. The second student will display an notification error "The choice is full and there are no available places" Test Two: Same setup as above, make sure the answers for the choices are cleared for students one and two. Go into mod/choice/lib.php and place sleep(10); after the the insert, but before the lock is released. (Line 391 is good) Submit student ones choice. Remove the sleep. Submit student two's choice. Expected The first student to save the result successfully. The second student will display an notification error "The choice is full and there are no available places" Test Three: In adding the locks I've moved the placing of the event recording. Ensure the Course logs report the correct events have occurred and been logged. Where? Course Admin ► Reports / ► Logs. Example: 18 Feb, 07:47 Admin User - Choice: TESTING Choice Choice made The user with id '2' made the choice with id '1' in the choice activity with course module id '6'. web 172.XXX.XXX.XXX Other testing: Relevant unit tests: vendor/bin/phpunit mod/choice/tests/events_test.php Play around with submitting random options and deleting them to make sure nothing has been broken. Are there cases where the lock isn't released properly? (exceptions etc, specifically the print_error calls) Timeouts reached under a reasonable load?
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull from Repository:
    • Pull 2.7 Branch:
    • Pull Master Branch:
      MDL-23273-master
    • Sprint:
      Team Beards Sprint 3
    • Issue size:
      Small

      Description

      To reproduce the bug:
      1.create a new course or use an existing one
      2.add item 'choice' with defaults values excpet the following settings:

      Limit the number of responses allowed = enable
      some choices where limit = 1
      Restrict answering to this time period = yes
      Display vertically
      Publish results = always show results to students
      privacy of results = publish full results, showing names and their choices
      group mode = separate groups

      3.login at 2 different PCs with different student account
      4.select same choice and hit 'save my choice' synchronously

      As you can see in the attachment, choosing a limited choice is possible. We have received some complaints by teachers using this tool. They report that (somehow) this effect happens quite often, especially when tight time period is enabled.

      Thank you for your help in advance!!!

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    9/Jul/12