Skip to content

Doubts: reject solving or skipping after the session is closed - #74

Open
vegadarsiwork wants to merge 1 commit into
NxtLabTech:mainfrom
vegadarsiwork:fix/issue-6-closed-session-finish
Open

vegadarsiwork wants to merge 1 commit into
NxtLabTech:mainfrom
vegadarsiwork:fix/issue-6-closed-session-finish

Conversation

@vegadarsiwork

@vegadarsiwork vegadarsiwork commented Nov 4, 2026 •

Copy link
Copy Markdown

What changed?

DoubtService::finish (used by markSolved and markSkipped) now loads the doubt's session with doubt['session_id']. If the session is CLOSED, it throws the existing SessionClosedException, which public/index.php already turns into a 409. The doubt is not changed.

What happens to a doubt that is still in progress when the mentor closes the session?
It stays IN_PROGRESS and is frozen, together with the rest of the session. This matches the rule in the issue (a closed session keeps the data it had at closing time) and keeps closing a session working the same way as now, at any time. The session's stats keep showing it as in progress, which is what was true when the session was closed. The mentor app already shows the server's error message in its error banner, so a mentor who tries to finish that doubt after closing sees the 409 message.

Which issue does this address?

Fixes #6

How was it tested?

  • Added testSolvingDoubtInClosedSessionThrows and testSkippingDoubtInClosedSessionThrows to DoubtServiceTest. Each checks that SessionClosedException is thrown and that the doubt still has status IN_PROGRESS and finished_at null.
  • Without the change in DoubtService, both new tests fail. With it, composer test: OK (19 tests, 44 assertions).
  • The existing testSolvedAndSkippedSetFinishedAt still passes (open sessions work as before).
  • Checked over HTTP with composer start and curl:
    • Open session: PATCH /api/doubts/{id}/solved → 200
    • After closing: PATCH .../solved → 409, PATCH .../skipped → 409, message Session with id 3 is closed, so its doubts can no longer be solved or skipped
    • The doubt is still IN_PROGRESS with finished_at: null, and /stats is the same before and after.
  • No changes in the Flutter app, so flutter analyze / flutter test were not run.

DoubtService::finish now loads the doubt's session and throws
SessionClosedException (409) when it is CLOSED, so a closed session's
doubts and stats stay as they were when it was closed.

Fixes NxtLabTech#6
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.

Reject marking a doubt as solved or skipped after its session is closed

1 participant