Quiz not redirecting to quiz/QUIZ-ID

Created on 16 October 2019, about 5 years ago
Updated 11 September 2024, 4 months ago

When the user is doing a quiz, if the session data necessary for navigation to the next question number is lost, the behaviour is erratic. The quiz should redirect back to quiz/QUID-ID path so the user can make a fresh start on the quiz. Currently a 403 'Access denied' occurs.

How to Fix it
Create an event listener. Listen to the 403 exception event. Add a condition so it applies if the current route is the quiz take route. Add a method to the QuizSessionInterface and implement it in QuizSession.php. It is a boolean that reports the current state of the quiz session data. It tests whether vital quiz session variables are missing.

Use the method as a second condition in the event listener.

πŸ“Œ Task
Status

Fixed

Version

7.0

Component

Code - Quiz core

Created by

πŸ‡¬πŸ‡§United Kingdom oily Greater London

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Will probably need test coverage

  • Merge request !41Resolve #3088468 "Quiz not redirecting" β†’ (Merged) created by oily
  • Pipeline finished with Canceled
    5 months ago
    Total: 468s
    #265307
  • πŸ‡¬πŸ‡§United Kingdom oily Greater London

    @Dhammika I notice that your 2x patches are named 'fixed-quiz-feedback-issue'. That sounds like it relates to a different issue? Can you please confirm that your patches fix this issue?

  • Pipeline finished with Success
    5 months ago
    Total: 674s
    #265318
  • Status changed to Needs review 5 months ago
  • πŸ‡¬πŸ‡§United Kingdom oily Greater London
  • Status changed to Needs work 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Only see a test file in the MR. Which if it’s covering a new change would expect to fail.

    Also appears to have standard issues.

  • Pipeline finished with Failed
    5 months ago
    Total: 1011s
    #265411
  • Pipeline finished with Failed
    5 months ago
    Total: 605s
    #265456
  • πŸ‡¬πŸ‡§United Kingdom oily Greater London

    I have tried applying the patch of @Dhammika but getting errors.

  • Status changed to Needs review 5 months ago
  • πŸ‡¬πŸ‡§United Kingdom oily Greater London
  • Status changed to Needs work 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    The MR should contain the full fix.

    It has a test only feature already built in for testing if it fails without the fix.

  • Pipeline finished with Failed
    5 months ago
    Total: 541s
    #270275
  • Pipeline finished with Failed
    5 months ago
    Total: 441s
    #270497
  • Pipeline finished with Failed
    5 months ago
    Total: 902s
    #270868
  • Pipeline finished with Failed
    5 months ago
    Total: 567s
    #270909
  • Pipeline finished with Failed
    5 months ago
    Total: 659s
    #270922
  • Pipeline finished with Failed
    5 months ago
    Total: 1356s
    #270976
  • Pipeline finished with Success
    5 months ago
    Total: 556s
    #271156
  • Pipeline finished with Success
    5 months ago
    Total: 491s
    #271198
  • Pipeline finished with Success
    5 months ago
    Total: 675s
    #271526
  • Pipeline finished with Success
    5 months ago
    Total: 669s
    #271564
  • Status changed to Needs review 5 months ago
  • πŸ‡¬πŸ‡§United Kingdom oily Greater London
  • πŸ‡¬πŸ‡§United Kingdom oily Greater London
  • πŸ‡¬πŸ‡§United Kingdom oily Greater London
  • πŸ‡¬πŸ‡§United Kingdom oily Greater London
  • πŸ‡¬πŸ‡§United Kingdom oily Greater London
  • πŸ‡¬πŸ‡§United Kingdom oily Greater London

    @smustgrave I have now included a full fix in the MR. I have updated the issue description.

  • Status changed to Needs work 4 months ago
  • πŸ‡¬πŸ‡§United Kingdom oily Greater London
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Why needs work?

  • πŸ‡¬πŸ‡§United Kingdom oily Greater London

    @smustgrave Because i thought maybe the reason you had not reviewed for a few days was that I had changed the status to 'needs review' and that that perhaps only maintainers should do that. I believe it IS ready for review.

  • Status changed to Needs review 4 months ago
  • πŸ‡¬πŸ‡§United Kingdom oily Greater London
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Nope you are free to put into review.

    Will try and get to sometime next week.

  • πŸ‡¬πŸ‡§United Kingdom oily Greater London

    @smustgrave Much appreciated.

  • πŸ‡¬πŸ‡§United Kingdom oily Greater London

    @smustgrave To make your task a bit easier, you will find one of my last changes was to an apparently random test. It was a test that I found was failing after I completed the task and got my test to pass. I discovered that the 'random' test contained an assertion for a 403 access denied. So I believed that the condition in my event listener (when a certain exception is raised) must be met in this 'random' test, also. So I edited the test to expect not a 403 but a 200 and redirect to quiz/quiz id. That made it pass along with my new test.

  • Status changed to Fixed 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Had to fix up the pipeline to have descriptions and used constructor promotion instead so it's all green now.

  • πŸ‡¬πŸ‡§United Kingdom oily Greater London

    Thank you for completing this fix!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024