Skip to content

Commit 45c47c9

Browse files
authored
Merge pull request #2507 from intersective/2.4.y.z/CORE-7970/double-pulsecheck
[CORE-7970] 2.4.y.z/double-pulsecheck
2 parents 266d3ea + 36ff628 commit 45c47c9

File tree

3 files changed

+30
-26
lines changed

3 files changed

+30
-26
lines changed

projects/v3/src/app/components/fast-feedback/fast-feedback.component.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,17 @@ export class FastFeedbackComponent implements OnInit {
204204
}
205205
}
206206

207-
dismiss(data) {
208-
// change the flag to false
207+
async dismiss(data): Promise<void> {
209208
this.storage.set("fastFeedbackOpening", false);
210-
this.modalController.dismiss(data);
211-
this.homeService.getPulseCheckStatuses().subscribe();
212-
this.homeService.getPulseCheckSkills().subscribe();
209+
await this.modalController.dismiss(data);
210+
await new Promise(resolve => setTimeout(resolve, 500));
211+
212+
try {
213+
await firstValueFrom(this.homeService.getPulseCheckStatuses());
214+
await firstValueFrom(this.homeService.getPulseCheckSkills());
215+
} catch (error) {
216+
console.error('Error refreshing pulse check data:', error);
217+
}
213218
}
214219

215220
get isRedColor(): boolean {

projects/v3/src/app/pages/assessment-mobile/assessment-mobile.page.ts

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { BrowserStorageService } from '@v3/app/services/storage.service';
66
import { ActivityService, Task } from '@v3/services/activity.service';
77
import { AssessmentService, Assessment, Submission, AssessmentReview } from '@v3/services/assessment.service';
88
import { UtilsService } from '@v3/app/services/utils.service';
9-
import { BehaviorSubject, firstValueFrom, Subject, Subscription } from 'rxjs';
9+
import { BehaviorSubject, filter, firstValueFrom, Subject, Subscription } from 'rxjs';
1010
import { ReviewService } from '@v3/app/services/review.service';
1111
import { AssessmentComponent } from '@v3/app/components/assessment/assessment.component';
1212
import { debounceTime } from 'rxjs/operators';
@@ -87,17 +87,20 @@ export class AssessmentMobilePage implements OnInit, OnDestroy {
8787
});
8888
this.subscriptions.add(paramsSub);
8989

90-
const assessmentSub = this.assessmentService.assessment$.subscribe(res => {
91-
if (!res && this.assessmentDataLoaded) {
92-
this.goBack();
93-
return;
94-
}
90+
const assessmentSub = this.assessmentService.assessment$.
91+
pipe(
92+
filter(res => res && this.assessmentDataLoaded), // only proceed if assessment data is loaded
93+
).subscribe(res => {
94+
if (!res) {
95+
this.goBack();
96+
return;
97+
}
9598

96-
if (res) {
97-
this.assessment = res;
98-
this.utils.setPageTitle(this.assessment?.name);
99-
}
100-
});
99+
if (res) {
100+
this.assessment = res;
101+
this.utils.setPageTitle(this.assessment?.name);
102+
}
103+
});
101104
this.subscriptions.add(assessmentSub);
102105

103106
const taskSub = this.activityService.currentTask$.subscribe(res => this.currentTask = res);
@@ -169,10 +172,6 @@ export class AssessmentMobilePage implements OnInit, OnDestroy {
169172
console.error('Asmt submission error:', saved);
170173
throw new Error("Error submitting assessment");
171174
}
172-
173-
if (this.assessment.pulseCheck === true && event.autoSave === false) {
174-
await this.assessmentService.pullFastFeedback();
175-
}
176175
} else if (this.action === 'review' && submission.status === 'pending review') {
177176
const saved = await firstValueFrom(this.assessmentService.submitReview(
178177
event.assessmentId,
@@ -197,13 +196,13 @@ export class AssessmentMobilePage implements OnInit, OnDestroy {
197196
await this.assessmentService.pullFastFeedback();
198197
}
199198

200-
this.savingText$.next($localize `Last saved ${this.utils.getFormatedCurrentTime()}`);
199+
this.savingText$.next($localize`Last saved ${this.utils.getFormatedCurrentTime()}`);
201200
if (!event.autoSave) {
202201
// show toast message
203202
if (hasSubmission === true) {
204203
this.notificationsService.assessmentSubmittedToast({ isDuplicated: true });
205204
} else {
206-
this.notificationsService.assessmentSubmittedToast({ isReview: this.action === 'review'});
205+
this.notificationsService.assessmentSubmittedToast({ isReview: this.action === 'review' });
207206
}
208207

209208
await this.assessmentService.fetchAssessment(
@@ -232,7 +231,7 @@ export class AssessmentMobilePage implements OnInit, OnDestroy {
232231
} catch (err) {
233232
this.btnDisabled$.next(false);
234233
this.saving = false;
235-
this.notificationsService.assessmentSubmittedToast({isFail: true});
234+
this.notificationsService.assessmentSubmittedToast({ isFail: true });
236235
}
237236
}
238237

@@ -246,7 +245,7 @@ export class AssessmentMobilePage implements OnInit, OnDestroy {
246245
return this.activityService.getActivity(this.activityId, true, this.task, () => {
247246
this.btnDisabled$.next(false);
248247
});
249-
} catch(err) {
248+
} catch (err) {
250249
this.btnDisabled$.next(false);
251250
console.error(err);
252251
}

projects/v3/src/app/pages/home/home.page.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ export class HomePage implements OnInit, OnDestroy, AfterViewChecked {
5353
unsubscribe$ = new Subject();
5454
milestones$: Observable<Milestone[]>;
5555

56-
@ViewChild('activityCol') activityCol: {el: HTMLIonColElement};
57-
@ViewChild('activities', {static: false}) activities!: ElementRef;
56+
@ViewChild('activityCol') activityCol: { el: HTMLIonColElement };
57+
@ViewChild('activities', { static: false }) activities!: ElementRef;
5858
pulseCheckSkills: PulseCheckSkill[] = [];
5959

6060
// Expose Math to template

0 commit comments

Comments
 (0)