Skip to content

Commit 340ad0d

Browse files
committed
feat(mon-pix): prevent live-alert trigger when the challenge is already answered
1 parent 147069e commit 340ad0d

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

mon-pix/app/controllers/assessments/challenge.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default class ChallengeController extends Controller {
2525
@tracked hasFocusedOutOfChallenge = false;
2626
@tracked hasUserConfirmedTimedChallengeWarning = false;
2727
@tracked isTextToSpeechActivated = true;
28+
@tracked isLiveAlertButtonEnabled = true;
2829

2930
get showLevelup() {
3031
return this.model.assessment.showLevelup && this.newLevel;
@@ -256,4 +257,9 @@ export default class ChallengeController extends Controller {
256257
'pix-event-name': `Clic sur le bouton d'activation de la vocalisation : ${this.isTextToSpeechActivated ? 'activé' : 'désactivé'}`,
257258
});
258259
}
260+
261+
@action
262+
handleChallengeSubmit() {
263+
this.isLiveAlertButtonEnabled = !this.isLiveAlertButtonEnabled;
264+
}
259265
}

mon-pix/app/routes/assessments/challenge.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ export default class ChallengeRoute extends Route {
6767
return true;
6868
}
6969

70+
setupController(controller, model) {
71+
super.setupController(controller, model);
72+
73+
controller.isLiveAlertButtonEnabled = true;
74+
}
75+
7076
resetController(controller, isExiting) {
7177
if (isExiting) {
7278
controller.set('hasFocusedOutOfChallenge', false);

mon-pix/app/templates/assessments/challenge.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,13 @@
8181
@hasFocusedOutOfWindow={{this.hasFocusedOutOfWindow}}
8282
@isFocusedChallengeAndUserHasFocusedOutOfChallenge={{this.isFocusedChallengeAndUserHasFocusedOutOfChallenge}}
8383
@isTextToSpeechActivated={{this.isTextToSpeechActivated}}
84+
@onChallengeSubmit={{this.handleChallengeSubmit}}
8485
/>
8586

8687
{{#unless @model.assessment.hasOngoingCompanionLiveAlert}}
8788
<div class="challenge__feedback" role="complementary">
8889
{{#if (eq @model.assessment.certificationCourse.version 3)}}
89-
<FeedbackPanelV3 @submitLiveAlert={{this.submitLiveAlert}} @assessment={{@model.assessment}} />
90+
<FeedbackPanelV3 @submitLiveAlert={{this.submitLiveAlert}} @assessment={{@model.assessment}} @isEnabled={{this.isLiveAlertButtonEnabled}} />
9091
{{else}}
9192
<FeedbackPanel @assessment={{@model.assessment}} @challenge={{@model.challenge}} />
9293
{{/if}}

0 commit comments

Comments
 (0)