[#13174] Student viewing responses: allow hiding self reponses #13187
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.
Fixes #13174
Outline of Solution
Toggle Checkbox for Self Responses:
Added a toggle checkbox to the session result page (File edit: session-result-page.component.html).
The checkbox controls a new boolean property,
hideMyResponses
, inSessionResultPageComponent
.Passing hideMyResponses to Child Components:
Updated the
QuestionResponsePanelComponent
to accept an@Input() hideMyResponses
property.The visibility of self responses is controlled based on the value of
hideMyResponses
.UI Updates:
The checkbox is implemented with custom styling classes (
toggle-container
,toggle-input
,toggle-label
).If
hideMyResponses
is set to true, the "self responses" section is hidden in the UI.Files Changed:
session-result-page.component.html:
Added the HTML for the toggle checkbox.
Updated the
QuestionResponsePanelComponent
to pass thehideMyResponses
property.session-result-page.component.ts:
Added a
hideMyResponses
boolean property.Created a
toggleHideSelfResponses()
method to handle the change event from the checkbox.question-response-panel.component.ts:
Updated to include an
@Input()
property calledhideMyResponses
.Modified the
ngIf
condition to control the visibility of self responses.The approach is adapted from #13175. and we add testing to the new changes.
Testing:
Added unit tests to verify the correct behavior of the toggle feature.
Tests include verifying the
hideMyResponses
property when the checkbox is toggled, and checking if the responses are correctly hidden or displayed in QuestionResponsePanelComponent.Updated the existing test suite (File changed: session-result-page.component.spec.ts) to include these new tests.
Screenshot of UI: