From b2d47e2cb42aa346d543058da23f3878df5a98de Mon Sep 17 00:00:00 2001 From: Tobias Messner Date: Thu, 28 Nov 2024 12:59:16 +0100 Subject: [PATCH] feat: Change feedback prompt for trainings --- .../feedback-dialog.component.html | 8 +------- .../feedback-dialog.component.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.html b/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.html index 0ea4f6873..29b87175f 100644 --- a/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.html +++ b/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.html @@ -9,13 +9,7 @@ (submit)="submit()" >

- @if (data.sessions.length === 0) { - How has your experience been? - } @else if (data.sessions.length === 1) { - How was your session? - } @else { - How were your sessions? - } + {{ promptText }}

diff --git a/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.ts b/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.ts index 68c2d39db..22caa7600 100644 --- a/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.ts +++ b/frontend/src/app/sessions/feedback/feedback-dialog/feedback-dialog.component.ts @@ -102,6 +102,24 @@ export class FeedbackDialogComponent { return Object.values(FeedbackRating); } + get promptText() { + if ( + this.data.sessions.some( + (session) => + session.version.tool.config.supported_project_types.length === 1 && + session.version.tool.config.supported_project_types[0] === 'training', + ) + ) { + return 'How was your training session?'; + } else if (this.data.sessions.length === 0) { + return 'How was your experience?'; + } else if (this.data.sessions.length === 1) { + return 'How was your session?'; + } else { + return 'How were your sessions?'; + } + } + submitButton = { disabled: false, text: 'Submit',