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

Quiz autosave takes the value of the submit button which had not been clicked

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1.4, 3.2.1, 3.6
    • Fix Version/s: 3.6.5, 3.7.1
    • Component/s: Questions
    • Labels:
    • Testing Instructions:
      Hide

      To test this, you need to be confident using the developer tools in your web browser.

      The attached screen-grabs may help you understand these steps. They show the old buggy behaviour.

      1. Go to Admin -> Plugins -> Activity modules -> Quiz, and set Auto-save delay to something short like 5 seconds.
      2. Create a quiz with:
        • "Time limit" in "Timing" set to 5 minutes.
        • "When time expires" in "Timing" set to "Open attempts are submitted automatically".
        • "How questions behave" in "Question behaviour" set to "Immediate feedback".
      3. Add some questions of a few different types to the quiz (e.g. Essay, Short-answer, Multi-choice, Match and drag-drop markers.) Have the questions all on one page.
      4. Start an attempt as a student.
      5. Open your browser developer tools and switch to the Network tab. If your site is set to show debugging messages, then you will see useful information about what is going on in the browser console (recommended).
      6. Change the answer to one or more questions.
      7. After 5 seconds, a new POST request to mod/quiz/autosave.ajax.php should appear in the Network tab. Click on that request to see the details, and find bit that shows the Params that were sent in the request.
      8. Verify that list does not contain any values with a name like '...-submit'.
      9. Now, close this tab (ignore the form-change-checker warning that you have unsaved data).
      10. Wait 5 minutes (for the time limit to expire).
      11. Go back in as the student, you should see that the attempt is submitted now.
      12. Now log in as teacher and review the student's attempt.
      13. Under each question you should see a table showing the 'Response history'.
      14. Verify that, where you input a response, the action is shown as Save: ..., rather than Submit: ...

       

      Show
      To test this, you need to be confident using the developer tools in your web browser. The attached screen-grabs may help you understand these steps. They show the old buggy behaviour. Go to Admin -> Plugins -> Activity modules -> Quiz, and set Auto-save delay to something short like 5 seconds. Create a quiz with: "Time limit" in "Timing" set to 5 minutes. "When time expires" in "Timing" set to "Open attempts are submitted automatically". "How questions behave" in "Question behaviour" set to "Immediate feedback". Add some questions of a few different types to the quiz (e.g. Essay, Short-answer, Multi-choice, Match and drag-drop markers.) Have the questions all on one page. Start an attempt as a student. Open your browser developer tools and switch to the Network tab. If your site is set to show debugging messages, then you will see useful information about what is going on in the browser console (recommended). Change the answer to one or more questions. After 5 seconds, a new POST request to mod/quiz/autosave.ajax.php should appear in the Network tab. Click on that request to see the details, and find bit that shows the Params that were sent in the request. Verify that list does not contain any values with a name like '...-submit'. Now, close this tab (ignore the form-change-checker warning that you have unsaved data). Wait 5 minutes (for the time limit to expire). Go back in as the student, you should see that the attempt is submitted now. Now log in as teacher and review the student's attempt. Under each question you should see a table showing the 'Response history'. Verify that, where you input a response, the action is shown as Save: ..., rather than Submit: ...  
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE
    • Pull 3.7 Branch:
    • Pull Master Branch:

      Description

      Steps to reproduce:

      1. Ensure that quiz auto-save is turned on in the quiz admin settings, and set the delay to something short like 10 seconds.
      2. Create a quiz set to Interactive with mulitple tries behaviour.
      3. Add one true-false question to the quiz. Make sure you put in feedback for each choice.
      4. As a student, start a quiz attempt.
      5. Select an answer to the true-false question, then wait 10 seconds for auto-save to do its thing. (Having browser developer tools open will help you verify this has happened.)
      6. Log out, ignoring any warning about unsaved data.
      7. As teacher, go and review this student's quiz attempt.

      Expected result: you can see the response the student selected, but no feedback.

      Actual result: feedback is visible. Response history in the table under the question shows a 'Submit' action. If you re-grade the quiz attempt, suddenty the student gets a mark awarded for this question, when they did not have one before.

      Quiz auto-save should ignore any <button> or <input type="button"> form controls.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              timhunt Tim Hunt
              Reporter:
              timhunt Tim Hunt
              Peer reviewer:
              Simey Lameze
              Integrator:
              Sara Arjona (@sarjona)
              Tester:
              Janelle Barcega
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                8/Jul/19

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 43 minutes
                  1h 43m