Problem/Motivation
When the session manager was refactored to work with entities instead of IDs it looks like a subtle logic error was introduced. The getResults function call will now not check for temporary sessions if a Quiz object is passed in vs the original logic in resultOrTemp that checks for a temporary session if the quiz id isn't found in an active session. That's preventing people from accessing the final question feedback screen before the results page is reached, because getSession will always return null once the session has been moved into temporary storage. The submitEnd function in QuizQuestionFeedbackForm also appeared to break because it was passing the quiz_result entity instead of the ID to the redirect constructor.
Proposed resolution
This patch removes the !$quiz check from the temporary session if statement and changes the submitEnd function to use the ID again. It also removed a second parameter that the resultOrTemp function was passing to getResult that no longer existed. In my testing that seemed to fix everything.
Comment | File | Size | Author |
---|---|---|---|
#17 | 3154985.patch | 6.64 KB | djdevin |
#11 | quiz_session-fixes-3154985-11.patch | 5.08 KB | jacobbell84 |
#4 | quiz_session-fixes-3154985-4.patch | 4.18 KB | jacobbell84 |
quiz_session-fixes.patch | 1.62 KB | jacobbell84 | |
Issue fork quiz-3154985
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
djdevinYou can use the new issue queue fork system now too!
Comment #4
jacobbell84 CreditAttribution: jacobbell84 commentedOh interesting, was just reading up a little on the issue fork system. So is the flow that I ask for push access and then can just commit to that vs having to make patches? That's pretty cool. I already had this patch ready, but I'll look into that next time.
Comment #5
jacobbell84 CreditAttribution: jacobbell84 commentedComment #6
djdevinThanks! Let's get a test on this. I don't think we have one for after the last question.
Comment #7
jacobbell84 CreditAttribution: jacobbell84 commentedGood idea, I changed the QuizFeedbackTest to run the same tests against the last question as it does the first question.
Comment #9
jacobbell84 CreditAttribution: jacobbell84 commentedWeird, updated test was failing because the second feedback page doesn't show feedback the same way the first one does.The more I was thinking about this though, we really just need to make sure we can access the page, we don't need to run the full tests again anyways. Trying a new patch with the simpler test.
Comment #10
jacobbell84 CreditAttribution: jacobbell84 commentedAttempting to fix the test
Comment #11
jacobbell84 CreditAttribution: jacobbell84 commentedOne more try.
Comment #12
jacobbell84 CreditAttribution: jacobbell84 commentedComment #13
djdevinThis looks great, thanks. I want to take a look at the test because after you hit "Finish" on the last question of a quiz that also has per-question feedback, you should immediately see the question feedback, and then the overall quiz feedback.
Comment #14
jacobbell84 CreditAttribution: jacobbell84 commentedSure, that works. It's weird, i downloaded the artifacts from the Jenkins build and based on the HTML output that's why it was failing....can't for the life of me figure out why that's happening though.
Comment #15
afagioliConfirming it works on latest quiz release.
Thanks for sharing
Comment #16
jacobbell84 CreditAttribution: jacobbell84 commentedHi @djdevin, have you had a chance to see why the tests for this ticket weren't acting correctly? I'm not very experienced with PHPUnit but I'd love to get this patch merged in.
Comment #17
djdevinSorry, got away from me. This works fine.
I updated the test and removed the hard coded URLs just to make sure that the system redirects and forms work correctly during that final question feedback -> final -> question feedback -> quiz feedback flow.
I tested this specific one already and it works but I'll merge it right after the full test run.
Comment #19
djdevinFixed, thanks
Comment #20
jacobbell84 CreditAttribution: jacobbell84 commentedGreat, thank you!
Comment #21
ugintl CreditAttribution: ugintl commented#17 worked
Comment #22
ugintl CreditAttribution: ugintl commented