Skip to content

[CORE-7981] 2.4.y/hardcoded-pulsecheck-quesid #2517

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

Open
wants to merge 2 commits into
base: golive/2.4.y
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 @@ -11,15 +11,23 @@

<ion-content class="ion-padding">
<div class="ion-text-center ion-margin-bottom">
<ng-container *ngIf="isSkillsPulseCheck; else defaultPulseCheck">
<p class="body-1" i18n>Select the skill level that best describes you right now.</p>
</ng-container>
<ng-template #defaultPulseCheck>
<p class="body-1" i18n>
Please help us to improve your experience.<br>
We want to know how are you doing.
<ng-container [ngSwitch]="pulseCheckType">
<p class="body-1" *ngSwitchCase="'skills'" i18n>
Select the skill level that best describes you right now.
</p>
<p class="body-1" *ngSwitchCase="'onTrack'" i18n>
Please help us improve your experience.<br>
We want to know how you are doing.
</p>
<p class="body-1" *ngSwitchCase="'both'" i18n>
Please help us improve your experience.<br>
We want to know how you are doing and how confident you feel about your skills.
</p>
</ng-template>
<p class="body-1" *ngSwitchDefault i18n>
Please help us improve your experience.<br>
We want to know how you are doing.
</p>
</ng-container>
</div>

<form (ngSubmit)="submit()" [formGroup]="fastFeedbackForm">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class FastFeedbackComponent implements OnInit {

// hover tracking for choice descriptions
hoveredChoice: string | null = null;
isSkillsPulseCheck: boolean = false;
pulseCheckType: 'onTrack' | 'skills' | 'both' | 'unknown' = 'unknown';

@Input() questions = [];
@Input() meta?: Meta;
Expand Down Expand Up @@ -71,6 +71,39 @@ export class FastFeedbackComponent implements OnInit {

this.totalPages = Math.ceil(this.questions.length / this.questionsPerPage);
this.showPagination = this.totalPages > 1;

// Determine pulse check type based on question IDs
this.pulseCheckType = this.determinePulseCheckType();
}

/**
* Determines the pulse check type based on question IDs
* onTrack: [7, 8, 9, 10]
* skills: [20, 21, 22, 23, 24, 25]
* both: contains questions from both sets
* @link https://intersective.atlassian.net/browse/CORE-7981?focusedCommentId=57127
*/
private determinePulseCheckType(): 'onTrack' | 'skills' | 'both' | 'unknown' {
const onTrackIds = [7, 8, 9, 10];
const skillsIds = [20, 21, 22, 23, 24, 25];
const questionIds = this.questions.map(q => q.id);

const hasOnTrackQuestions = questionIds.some(id => onTrackIds.includes(id));
const hasSkillsQuestions = questionIds.some(id => skillsIds.includes(id));

if (hasOnTrackQuestions && hasSkillsQuestions) {
return 'both';
} else if (hasSkillsQuestions) {
return 'skills';
} else if (hasOnTrackQuestions) {
return 'onTrack';
}

return 'unknown';
}

get isSkillsPulseCheck(): boolean {
return this.pulseCheckType === 'skills' || this.pulseCheckType === 'both';
}

get currentPageQuestions() {
Expand Down
1 change: 0 additions & 1 deletion projects/v3/src/app/services/fast-feedback.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ export class FastFeedbackService {
{
questions,
meta,
isSkillsPulseCheck: options.type === 'skills',
},
{
closable: options.closable,
Expand Down
1 change: 0 additions & 1 deletion projects/v3/src/app/services/notifications.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,6 @@ export class NotificationsService {
props: {
questions?: Question[];
meta?: Meta | Object;
isSkillsPulseCheck?: boolean;
},
options: {
closable?: boolean;
Expand Down