Repository navigation
Doubts: reject solving or skipping after the session is closed - #74
Open
vegadarsiwork wants to merge 1 commit into
Open
vegadarsiwork wants to merge 1 commit into
vegadarsiwork wants to merge 1 commit into
Conversation
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
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.
What changed?
DoubtService::finish(used bymarkSolvedandmarkSkipped) now loads the doubt's session withdoubt['session_id']. If the session isCLOSED, it throws the existingSessionClosedException, whichpublic/index.phpalready turns into a409. The doubt is not changed.What happens to a doubt that is still in progress when the mentor closes the session?
It stays
IN_PROGRESSand 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?
testSolvingDoubtInClosedSessionThrowsandtestSkippingDoubtInClosedSessionThrowstoDoubtServiceTest. Each checks thatSessionClosedExceptionis thrown and that the doubt still has statusIN_PROGRESSandfinished_atnull.DoubtService, both new tests fail. With it,composer test: OK (19 tests, 44 assertions).testSolvedAndSkippedSetFinishedAtstill passes (open sessions work as before).composer startand curl:PATCH /api/doubts/{id}/solved→200PATCH .../solved→409,PATCH .../skipped→409, messageSession with id 3 is closed, so its doubts can no longer be solved or skippedIN_PROGRESSwithfinished_at: null, and/statsis the same before and after.flutter analyze/flutter testwere not run.