[#13594] Question incorrectly displayed as saved when there are submission errors#13595
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes an issue in the feedback session submission UI where a question tab could be shown as “saved” even when submissions fail, by tightening the conditions under which “saved/changed” state is updated.
Changes:
- Removes
isSubmitAllClickedstate plumbing and centralizes “changed” tracking onhasResponseChangedForRecipients. - Updates save flow to reset “changed” flags only on successful save, and renames
getformattedSessionClosingTimetogetFormattedSessionClosingTime. - Updates unit tests and snapshots to reflect the new state tracking and template bindings.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/web/app/pages-session/session-submission-page/session-submission-page.component.ts | Adjusts save flow and “changed” reset logic; renames session closing-time formatter; changes recipient-save error handling. |
| src/web/app/pages-session/session-submission-page/session-submission-page.component.spec.ts | Updates save-flow tests to reflect new hasResponseChangedForRecipients behavior and updated method signature. |
| src/web/app/pages-session/session-submission-page/session-submission-page.component.html | Removes isSubmitAllClicked bindings and updates save handler calls to match the new signature. |
| src/web/app/pages-session/session-submission-page/snapshots/session-submission-page.component.spec.ts.snap | Snapshot updates removing the isSubmitAllClicked input. |
| src/web/app/components/question-submission-form/question-submission-form.component.ts | Replaces mutable hasResponseChanged with a getter; simplifies saved-state calculation; removes isSubmitAllClicked input/output. |
| src/web/app/components/question-submission-form/question-submission-form.component.spec.ts | Updates/extends tests for the new derived hasResponseChanged and revised saved-state behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
473e9fe to
71eb7ab
Compare
ec11b76 to
71eb7ab
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
src/web/app/pages-session/session-submission-page/session-submission-page.component.spec.ts:757
- This test is marked async but does not await anything. If async is not needed here, please remove it to avoid implying asynchronous behavior (and to satisfy linters that flag unnecessary async functions).
it('should snap with feedback session question submission forms', async () => {
component.questionSubmissionForms = [
testMcqQuestionSubmissionForm,
testTextQuestionSubmissionForm,
testMcqQuestionSubmissionForm2,
testMsqQuestionSubmissionForm,
testNumscaleQuestionSubmissionForm,
testConstsumQuestionSubmissionForm,
testContribQuestionSubmissionForm,
testRubricQuestionSubmissionForm,
testRankOptionsQuestionSubmissionForm,
testRankRecipientsQuestionSubmissionForm,
];
component.isCourseLoading = false;
component.isFeedbackSessionLoading = false;
component.isFeedbackSessionQuestionsLoading = false;
fixture.detectChanges();
expect(fixture).toMatchSnapshot();
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| commentEditFormModel: { | ||
| commentText: 'comment text here', | ||
| isUsingCustomVisibilities: false, | ||
| isUsingCustomVisibilities: true, |
There was a problem hiding this comment.
In this test comment model, isUsingCustomVisibilities is set to true, but the production getCommentModel() explicitly sets participant comments to not use custom visibilities. The fixture should match production behavior (and/or include showCommentTo/showGiverNameTo only when custom visibilities are enabled) to avoid testing an impossible state.
| isUsingCustomVisibilities: true, | |
| isUsingCustomVisibilities: false, |
There was a problem hiding this comment.
Current bug - when isUsingCustomVisibilities is set to false, a state change is triggered which updates isModified. This will be resolved in another PR.
Fixes #13594
Outline of Solution
Root cause was that
hasResponseChangedForRecipientsandisSavedis unconditionally set even when there are submission failures. The initial solution was to set these only when the response has been successfully saved.However, a lot of subtle bugs were uncovered because
hasResponseChangedForRecipients,hasResponseChanged,isSavedandisSubmitAllClickedare all states related states that are managed separately and updated independently in various places. In addition,recipientId(the key ofhasResponseChangedForRecipients) is not a stable key, it can be updated and modified, leading to more bugs.To solve this,
isModifiedwas added to the question response model. This serves as the source of truth of whether a response has been modified. All other variables were either removed (if redundant) or now derive their state fromisModified.