Skip to content

Commit

Permalink
feat(mon-pix): prevent live-alert trigger when the challenge is alrea…
Browse files Browse the repository at this point in the history
…dy answered
  • Loading branch information
Jeyffrey committed Mar 5, 2025
1 parent 147069e commit 340ad0d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions mon-pix/app/controllers/assessments/challenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default class ChallengeController extends Controller {
@tracked hasFocusedOutOfChallenge = false;
@tracked hasUserConfirmedTimedChallengeWarning = false;
@tracked isTextToSpeechActivated = true;
@tracked isLiveAlertButtonEnabled = true;

get showLevelup() {
return this.model.assessment.showLevelup && this.newLevel;
Expand Down Expand Up @@ -256,4 +257,9 @@ export default class ChallengeController extends Controller {
'pix-event-name': `Clic sur le bouton d'activation de la vocalisation : ${this.isTextToSpeechActivated ? 'activé' : 'désactivé'}`,
});
}

@action
handleChallengeSubmit() {
this.isLiveAlertButtonEnabled = !this.isLiveAlertButtonEnabled;
}
}
6 changes: 6 additions & 0 deletions mon-pix/app/routes/assessments/challenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ export default class ChallengeRoute extends Route {
return true;
}

setupController(controller, model) {
super.setupController(controller, model);

controller.isLiveAlertButtonEnabled = true;
}

resetController(controller, isExiting) {
if (isExiting) {
controller.set('hasFocusedOutOfChallenge', false);
Expand Down
3 changes: 2 additions & 1 deletion mon-pix/app/templates/assessments/challenge.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,13 @@
@hasFocusedOutOfWindow={{this.hasFocusedOutOfWindow}}
@isFocusedChallengeAndUserHasFocusedOutOfChallenge={{this.isFocusedChallengeAndUserHasFocusedOutOfChallenge}}
@isTextToSpeechActivated={{this.isTextToSpeechActivated}}
@onChallengeSubmit={{this.handleChallengeSubmit}}
/>

{{#unless @model.assessment.hasOngoingCompanionLiveAlert}}
<div class="challenge__feedback" role="complementary">
{{#if (eq @model.assessment.certificationCourse.version 3)}}
<FeedbackPanelV3 @submitLiveAlert={{this.submitLiveAlert}} @assessment={{@model.assessment}} />
<FeedbackPanelV3 @submitLiveAlert={{this.submitLiveAlert}} @assessment={{@model.assessment}} @isEnabled={{this.isLiveAlertButtonEnabled}} />
{{else}}
<FeedbackPanel @assessment={{@model.assessment}} @challenge={{@model.challenge}} />
{{/if}}
Expand Down

0 comments on commit 340ad0d

Please sign in to comment.