Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#13174] Option to hide self responses when viewing responses #13175

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ exports[`QuestionResponsePanelComponent should snap with feedback session with q
<tm-question-response-panel
RESPONSE_HIDDEN_QUESTIONS={[Function Array]}
feedbackSessionsService={[Function FeedbackSessionsService]}
hideSelfResponses="false"
intent={[Function String]}
previewAsPerson=""
questions={[Function Array]}
Expand Down Expand Up @@ -438,6 +439,7 @@ exports[`QuestionResponsePanelComponent should snap with feedback session with q
<tm-question-response-panel
RESPONSE_HIDDEN_QUESTIONS={[Function Array]}
feedbackSessionsService={[Function FeedbackSessionsService]}
hideSelfResponses="false"
intent={[Function String]}
previewAsPerson=""
questions={[Function Array]}
Expand Down Expand Up @@ -745,6 +747,7 @@ exports[`QuestionResponsePanelComponent should snap with questions and responses
<tm-question-response-panel
RESPONSE_HIDDEN_QUESTIONS={[Function Array]}
feedbackSessionsService={[Function FeedbackSessionsService]}
hideSelfResponses="false"
intent={[Function String]}
previewAsPerson=""
questions={[Function Array]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<strong>Other responses (to you): </strong>Responses are not visible to you.
</div>
</ng-template>
<div class="given-responses mt-4" *ngIf="question.responsesFromSelf.length">
<div class="given-responses mt-4" *ngIf="question.responsesFromSelf.length && !hideSelfResponses">
<strong>Your own responses (to others):</strong>
<div *ngFor="let responseFromSelf of question.responsesFromSelf">
<tm-student-view-responses [responses]="[responseFromSelf]" [isSelfResponses]="true" [feedbackQuestion]="question.feedbackQuestion" [timezone]="session.timeZone" [statistics]="question.questionStatistics"></tm-student-view-responses>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ export class QuestionResponsePanelComponent {
@Input()
previewAsPerson: string = '';

@Input()
hideSelfResponses: boolean = false;

canUserSeeResponses(question: FeedbackQuestionModel): boolean {
const showResponsesTo: FeedbackVisibilityType[] = question.feedbackQuestion.showResponsesTo;
if (this.intent === Intent.STUDENT_RESULT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ exports[`SessionResultPageComponent should snap when previewing results 1`] = `
formattedSessionClosingTime=""
formattedSessionOpeningTime=""
hasFeedbackSessionResultsLoadingFailed="false"
hideSelfResponses="false"
instructorService={[Function InstructorService]}
intent={[Function String]}
isCourseLoading="false"
Expand Down Expand Up @@ -128,6 +129,20 @@ exports[`SessionResultPageComponent should snap when previewing results 1`] = `
</div>
</div>
</div>
</div><div
class="form-check form-switch"
>
<input
class="form-check-input"
id="hideOwnResponses"
type="checkbox"
/>
<label
class="form-check-label"
for="hideOwnResponses"
>
Hide my own responses
</label>
</div><tm-loading-retry>
<div>
<div
Expand Down Expand Up @@ -165,6 +180,7 @@ exports[`SessionResultPageComponent should snap when session results failed to l
formattedSessionClosingTime=""
formattedSessionOpeningTime=""
hasFeedbackSessionResultsLoadingFailed={[Function Boolean]}
hideSelfResponses="false"
instructorService={[Function InstructorService]}
intent={[Function String]}
isCourseLoading="false"
Expand Down Expand Up @@ -277,6 +293,20 @@ exports[`SessionResultPageComponent should snap when session results failed to l
</div>
</div>
</div>
</div><div
class="form-check form-switch"
>
<input
class="form-check-input"
id="hideOwnResponses"
type="checkbox"
/>
<label
class="form-check-label"
for="hideOwnResponses"
>
Hide my own responses
</label>
</div><tm-loading-retry>
<div
class="text-center"
Expand Down Expand Up @@ -317,6 +347,7 @@ exports[`SessionResultPageComponent should snap with an open feedback session wi
formattedSessionClosingTime=""
formattedSessionOpeningTime=""
hasFeedbackSessionResultsLoadingFailed="false"
hideSelfResponses="false"
instructorService={[Function InstructorService]}
intent={[Function String]}
isCourseLoading="false"
Expand Down Expand Up @@ -429,6 +460,20 @@ exports[`SessionResultPageComponent should snap with an open feedback session wi
</div>
</div>
</div>
</div><div
class="form-check form-switch"
>
<input
class="form-check-input"
id="hideOwnResponses"
type="checkbox"
/>
<label
class="form-check-label"
for="hideOwnResponses"
>
Hide my own responses
</label>
</div><tm-loading-retry>
<div>
<div
Expand Down Expand Up @@ -466,6 +511,7 @@ exports[`SessionResultPageComponent should snap with default fields 1`] = `
formattedSessionClosingTime=""
formattedSessionOpeningTime=""
hasFeedbackSessionResultsLoadingFailed="false"
hideSelfResponses="false"
instructorService={[Function InstructorService]}
intent={[Function String]}
isCourseLoading="false"
Expand Down Expand Up @@ -578,6 +624,20 @@ exports[`SessionResultPageComponent should snap with default fields 1`] = `
</div>
</div>
</div>
</div><div
class="form-check form-switch"
>
<input
class="form-check-input"
id="hideOwnResponses"
type="checkbox"
/>
<label
class="form-check-label"
for="hideOwnResponses"
>
Hide my own responses
</label>
</div><tm-loading-retry>
<div>
<div
Expand Down Expand Up @@ -615,6 +675,7 @@ exports[`SessionResultPageComponent should snap with session details and results
formattedSessionClosingTime=""
formattedSessionOpeningTime=""
hasFeedbackSessionResultsLoadingFailed="false"
hideSelfResponses="false"
instructorService={[Function InstructorService]}
intent={[Function String]}
isCourseLoading={[Function Boolean]}
Expand Down Expand Up @@ -676,7 +737,21 @@ exports[`SessionResultPageComponent should snap with session details and results
Loading...
</div>
</div>
</tm-loading-spinner><tm-loading-retry>
</tm-loading-spinner><div
class="form-check form-switch"
>
<input
class="form-check-input"
id="hideOwnResponses"
type="checkbox"
/>
<label
class="form-check-label"
for="hideOwnResponses"
>
Hide my own responses
</label>
</div><tm-loading-retry>
<tm-loading-spinner>
<div
class="loading-container"
Expand Down Expand Up @@ -713,6 +788,7 @@ exports[`SessionResultPageComponent should snap with session details loaded and
formattedSessionClosingTime=""
formattedSessionOpeningTime=""
hasFeedbackSessionResultsLoadingFailed="false"
hideSelfResponses="false"
instructorService={[Function InstructorService]}
intent={[Function String]}
isCourseLoading="false"
Expand Down Expand Up @@ -825,6 +901,20 @@ exports[`SessionResultPageComponent should snap with session details loaded and
</div>
</div>
</div>
</div><div
class="form-check form-switch"
>
<input
class="form-check-input"
id="hideOwnResponses"
type="checkbox"
/>
<label
class="form-check-label"
for="hideOwnResponses"
>
Hide my own responses
</label>
</div><tm-loading-retry>
<tm-loading-spinner>
<div
Expand Down Expand Up @@ -862,6 +952,7 @@ exports[`SessionResultPageComponent should snap with user that is logged in and
formattedSessionClosingTime=""
formattedSessionOpeningTime=""
hasFeedbackSessionResultsLoadingFailed="false"
hideSelfResponses="false"
instructorService={[Function InstructorService]}
intent={[Function String]}
isCourseLoading="false"
Expand Down Expand Up @@ -975,6 +1066,20 @@ exports[`SessionResultPageComponent should snap with user that is logged in and
</div>
</div>
</div>
</div><div
class="form-check form-switch"
>
<input
class="form-check-input"
id="hideOwnResponses"
type="checkbox"
/>
<label
class="form-check-label"
for="hideOwnResponses"
>
Hide my own responses
</label>
</div><tm-loading-retry>
<div>
<div
Expand Down Expand Up @@ -1012,6 +1117,7 @@ exports[`SessionResultPageComponent should snap with user that is not logged in
formattedSessionClosingTime=""
formattedSessionOpeningTime=""
hasFeedbackSessionResultsLoadingFailed="false"
hideSelfResponses="false"
instructorService={[Function InstructorService]}
intent={[Function String]}
isCourseLoading="false"
Expand Down Expand Up @@ -1124,6 +1230,20 @@ exports[`SessionResultPageComponent should snap with user that is not logged in
</div>
</div>
</div>
</div><div
class="form-check form-switch"
>
<input
class="form-check-input"
id="hideOwnResponses"
type="checkbox"
/>
<label
class="form-check-label"
for="hideOwnResponses"
>
Hide my own responses
</label>
</div><tm-loading-retry>
<div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ <h4>Previewing Session Results as
</div>
</div>

<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="hideOwnResponses" [(ngModel)]="hideSelfResponses">
<label class="form-check-label" for="hideOwnResponses">Hide my own responses</label>
</div>

<tm-loading-retry [shouldShowRetry]="hasFeedbackSessionResultsLoadingFailed" [message]="'Failed to load results'" (retryEvent)="retryLoadingFeedbackSessionResults()">
<div *tmIsLoading="isFeedbackSessionResultsLoading">
<div *ngIf="questions.length === 0" class="mt-4">
Expand All @@ -82,6 +87,7 @@ <h4>Previewing Session Results as
</div>
<tm-question-response-panel [questions]="questions" [session]="session"
[intent]="intent" [regKey]="regKey" [previewAsPerson]="previewAsPerson"
[hideSelfResponses]="hideSelfResponses"
></tm-question-response-panel>
</div>
</tm-loading-retry>
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ export class SessionResultPageComponent implements OnInit {
feedbackSessionId: string | undefined = '';
studentId: string | undefined = '';

hideSelfResponses: boolean = false;

private backendUrl: string = environment.backendUrl;

constructor(private feedbackQuestionsService: FeedbackQuestionsService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { RouterModule, Routes } from '@angular/router';

import { SessionResultPageComponent } from './session-result-page.component';
Expand All @@ -25,6 +26,7 @@ const routes: Routes = [
@NgModule({
imports: [
CommonModule,
FormsModule,
QuestionTextWithInfoModule,
StudentViewResponsesModule,
SingleStatisticsModule,
Expand Down
Loading