Skip to content

[ALT-11077] Keep a solved quiz solved after Next opens a new step - #81

Merged
Tsyklop merged 1 commit into
mainfrom
bug/ALT-11077-quiz-status-after-next
Nov 30, 2026
Merged

Tsyklop merged 1 commit into
mainfrom
bug/ALT-11077-quiz-status-after-next

Conversation

@Tsyklop

@Tsyklop Tsyklop commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator

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

  • Next reloads the topic's solutions. When a new step of the topic is opened, HyperskillOpenInIdeRequestHandler.synchronizeProjectOnStepOpening loads the solutions of all its tasks again. HyperskillSolutionLoader takes the newest submission of each task from SubmissionsManager, and for a QuizTask it applies only that submission's status.
  • Quiz submissions were never stored. periodicallyCheckSubmissionResult added the checked submission to SubmissionsManager only when task.supportSubmissions is true. It is false for QuizTask, 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 to SubmissionsManager. The Submissions tab is still shown only for tasks with supportSubmissions, 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 new SubmissionsManager.setSubmissions. An empty list isn't stored, because getSubmissions also returns one when the request fails.
  • checkUnsupportedTask: now takes the project, which checkBySubmissions needs.

Testing

  • New tests: two tests in HyperskillCheckQuizTaskTest, one with an answer from the form and one without the form. Each test:

    • stores a wrong submission, as if it was loaded when the project was opened;
    • checks the task with a correct answer;
    • calls HyperskillSolutionLoader.loadAndApplySolutions, as Next does;
    • expects the task to stay solved.

    Both tests fail without the fix.

  • Test run: on 263, the stepik.hyperskill.* and submissions.* 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.

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.
@Tsyklop
Tsyklop merged commit 80cc7e2 into main Nov 30, 2026
1 of 2 checks passed
@Tsyklop
Tsyklop deleted the bug/ALT-11077-quiz-status-after-next branch November 30, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant