Repository navigation
[ALT-11077] Keep a solved quiz solved after Next opens a new step - #81
Merged
Merged
Conversation
Opening a new step of the topic loads the solutions of all its tasks again, and each task gets the status of its newest known submission. Quiz submissions made in the IDE were never added to SubmissionsManager, because it was done only for tasks with the Submissions tab. So a quiz answered wrong before the project was opened and solved afterwards got the old wrong status back. The result of a check is now always added to the known submissions, and the check without the quiz form replaces them with what the server returned.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A tester of the quiz support from #68 reported that a solved quiz step sometimes showed "Incorrect" and Retry again after they clicked Next. In their log, the step had a wrong answer from before the IDE was restarted. They then answered it several times in the IDE, and the last answer was correct. Right after Next opened the following step, the plugin applied the old wrong submission to it.
Cause
HyperskillOpenInIdeRequestHandler.synchronizeProjectOnStepOpeningloads the solutions of all its tasks again.HyperskillSolutionLoadertakes the newest submission of each task fromSubmissionsManager, and for aQuizTaskit applies only that submission's status.periodicallyCheckSubmissionResultadded the checked submission toSubmissionsManageronly whentask.supportSubmissionsis true. It is false forQuizTask, so the memory still held only the submissions loaded when the project was opened.This only affects a quiz that had a wrong answer before the project was opened and was then solved in the IDE. Every Next that opens a new step puts it back to the old status. Many retries don't cause it; they only make an earlier wrong answer more likely.
Fix
periodicallyCheckSubmissionResult: always adds the finished submission toSubmissionsManager. The Submissions tab is still shown only for tasks withsupportSubmissions, so the UI doesn't change.containsCorrectSubmission, which the course view progress uses, now also sees quizzes solved in this session, which matches their status.checkBySubmissions: this is the check of a quiz without the form, of an html step without the form, and of unsupported steps. It now replaces the task's known submissions with the list the server returned, using the newSubmissionsManager.setSubmissions. An empty list isn't stored, becausegetSubmissionsalso returns one when the request fails.checkUnsupportedTask: now takes the project, whichcheckBySubmissionsneeds.Testing
New tests: two tests in
HyperskillCheckQuizTaskTest, one with an answer from the form and one without the form. Each test:HyperskillSolutionLoader.loadAndApplySolutions, as Next does;Both tests fail without the fix.
Test run: on 263, the
stepik.hyperskill.*andsubmissions.*test packages ran 246 tests, all passed.IDE: not checked in the IDE yet. A 2026.3 build with this fix went to the tester. Other platforms are checked only by CI.
Not in this PR
SubmissionsManager.getOrLoadSubmissions(tasks)returns the submissions from memory whenever any of the tasks has some. So when Next adds a step to an already opened topic, the step's earlier submissions from the website aren't loaded. This was already the case before this change.