Skip to content
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

mes-9250-VehicleCheckWording #1487

Merged
merged 4 commits into from
Jan 19, 2024
Merged
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 @@ -98,7 +98,7 @@ describe('VehicleChecksCardCatBComponent', () => {
store$.dispatch(TellMeQuestionDrivingFault());
fixture.detectChanges();
const tellMeQuestionText = fixture.debugElement.query(By.css('#tell-me-question')).nativeElement;
expect(tellMeQuestionText.innerHTML.trim()).toBe('Tell me question - Driving fault');
expect(tellMeQuestionText.innerHTML.trim()).toBe('Tell me question - Incorrect');
});
it('should indicate a tell me fault in Welsh for a Welsh test', (done) => {
fixture.detectChanges();
Expand All @@ -107,10 +107,9 @@ describe('VehicleChecksCardCatBComponent', () => {
translate.use('cy').subscribe(() => {
fixture.detectChanges();
const tellMeQuestionText = fixture.debugElement.query(By.css('#tell-me-question')).nativeElement;
const questionText = (<any>welshTranslations).debrief.tellMeQuestion;
const drvingFaultText = (<any>welshTranslations).debrief.drivingFault;
const { tellMeQuestion, incorrect } = (<any>welshTranslations).debrief;
expect(tellMeQuestionText.innerHTML.trim())
.toBe(`${questionText} - ${drvingFaultText}`);
.toBe(`${tellMeQuestion} - ${incorrect}`);
done();
});
});
Expand All @@ -122,7 +121,7 @@ describe('VehicleChecksCardCatBComponent', () => {
translate.use('en').subscribe(() => {
fixture.detectChanges();
const showMeQuestionText = fixture.debugElement.query(By.css('#show-me-question-outcome-df')).nativeElement;
expect(showMeQuestionText.innerHTML.trim()).toBe('Show me question - Driving fault');
expect(showMeQuestionText.innerHTML.trim()).toBe('Show me question - Incorrect');
});
});
it('should indicate a show me driving fault in Welsh for a Welsh test', (done) => {
Expand All @@ -132,8 +131,8 @@ describe('VehicleChecksCardCatBComponent', () => {
translate.use('cy').subscribe(() => {
fixture.detectChanges();
const showMeQuestionText = fixture.debugElement.query(By.css('#show-me-question-outcome-df')).nativeElement;
const { showMeQuestion, drivingFault } = (<any>welshTranslations).debrief;
const expectedTranslation = `${showMeQuestion} - ${drivingFault}`;
const { showMeQuestion, incorrect } = (<any>welshTranslations).debrief;
const expectedTranslation = `${showMeQuestion} - ${incorrect}`;
expect(showMeQuestionText.innerHTML.trim()).toBe(expectedTranslation);
done();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
</ion-col>
<ion-col class="down-padding ion-align-items-start">
<div id="tell-me-question" *ngIf="componentState.tellMeQuestionHasFault$ | async">
{{ 'debrief.tellMeQuestion' | translate }} - {{ displayIncorrect ? ('debrief.incorrect' | translate) :
('debrief.drivingFault' | translate) }}
{{ 'debrief.tellMeQuestion' | translate }} - {{ 'debrief.incorrect' | translate }}
</div>
<div
id="show-me-question"
*ngIf="componentState.hasShowMeFault$ | async"
[ngSwitch]="componentState.showMeQuestionOutcome$ | async"
>
<span *ngSwitchCase="'DF'" id="show-me-question-outcome-df">
{{ 'debrief.showMeQuestion' | translate }} - {{ 'debrief.drivingFault' | translate }}
{{ 'debrief.showMeQuestion' | translate }} - {{ 'debrief.incorrect' | translate }}
</span>
<span *ngSwitchCase="'S'" id="show-me-question-outcome-s">
{{ 'debrief.showMeQuestion' | translate }} - {{ 'debrief.seriousFault' | translate }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { Store, select } from '@ngrx/store';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
Expand Down Expand Up @@ -28,9 +28,6 @@ export class VehicleChecksCardCatBComponent implements OnInit {

componentState: VehicleChecksCardComponentState;

@Input()
displayIncorrect: boolean = false;

constructor(private store$: Store<StoreModel>) { }

ngOnInit(): void {
Expand Down
6 changes: 1 addition & 5 deletions src/app/pages/debrief/debrief.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@
>
</eco-debrief-card>

<vehicle-checks-card-cat-b
*ngIf="isCategoryBTest()"
[displayIncorrect]="pageState.vehicleChecksShowIncorrect$ | async"
>
</vehicle-checks-card-cat-b>
<vehicle-checks-card-cat-b *ngIf="isCategoryBTest()"> </vehicle-checks-card-cat-b>

<vehicle-checks-card
*ngIf="showVehicleChecksArrayCard()"
Expand Down
8 changes: 0 additions & 8 deletions src/app/pages/debrief/debrief.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ interface DebriefPageState {
seriousFaults$: Observable<string[]>;
dangerousFaults$: Observable<string[]>;
drivingFaults$: Observable<(FaultSummary)[]>;
vehicleChecksShowIncorrect$: Observable<boolean>;
drivingFaultCount$: Observable<number>;
etaFaults$: Observable<ETA>;
ecoFaults$: Observable<Eco>;
Expand Down Expand Up @@ -171,13 +170,6 @@ export class DebriefPage extends PracticeableBasePageComponent implements OnInit
map(([data, category]) => this.faultSummaryProvider.getDrivingFaultsList(data, category as TestCategory)),
take(1),
),
vehicleChecksShowIncorrect$: currentTest$.pipe(
select(getTestData),
withLatestFrom(testCategory$),
map(([data, category]) => this.faultSummaryProvider
.shouldShowIncorrect(data, category as TestCategory)),
take(1),
),
drivingFaultCount$: currentTest$.pipe(
select(getTestData),
withLatestFrom(testCategory$),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<ion-grid>
<ion-row class="padding">
<div class="validation-bar" [class.ng-invalid]="invalid"></div>
<ion-col class="fault-badge ion-align-self-start ion-no-padding" size="4" [ngSwitch]="faultType">
<ion-col
[class.fault-badge-top-padding]="accessibilityService.getTextZoomClass() !== 'text-zoom-regular'"
class="fault-badge ion-align-self-start ion-no-padding"
size="4"
[ngSwitch]="faultType"
>
<dangerous-fault-badge
[showBadge]="true"
*ngSwitchCase="'dangerous'"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
:host {
.fault-badge {
padding-top: 5px;
padding-left: 10px;
}

.fault-badge-top-padding {
padding-top: 5px;
}

.padding {
padding-top: 15px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
OutcomeBehaviourMapProvider,
VisibilityType,
} from '@providers/outcome-behaviour-map/outcome-behaviour-map';
import { AccessibilityService } from '@providers/accessibility/accessibility.service';

enum ValidFaultTypes {
DRIVING = 'driving',
Expand Down Expand Up @@ -58,7 +59,9 @@ export class FaultCommentComponent implements OnChanges {

faultCommentCharsRemaining: number = null;
static readonly fieldName: string = 'faultComment';
constructor(private outcomeBehaviourProvider: OutcomeBehaviourMapProvider) { }
constructor(private outcomeBehaviourProvider: OutcomeBehaviourMapProvider,
protected accessibilityService: AccessibilityService
) { }

ngOnChanges(): void {
// mes 2393 - need to remove validations if < 16 faults as comments can
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ <h2 class="des-header-style-4" id="view-test-result-debrief-title">Debrief</h2>

<vehicle-checks-data-row
*ngIf="!delegatedTest && !isMod1() && !isMod2()"
[shouldDisplayIncorrect]="displayIncorrectText"
[label]="'Tell me question(s)'"
[data]="tellMeQuestions"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ export class DebriefCardComponent implements OnInit {
@Input()
delegatedTest: boolean = false;

@Input()
displayIncorrectText: boolean = false;

showMeQuestion: VehicleChecksQuestion;
tellMeQuestion: VehicleChecksQuestion;
manoeuvres: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
<div *ngFor="let item of data;">
<div class="mes-data large">
<span class="mes-data large bold">{{item.code}} </span>- {{item.description}}
<span class="mes-data large bold" *ngIf="shouldShowFault(item.outcome) && !shouldDisplayIncorrect">
(1 driving fault)
</span>
<span class="mes-data large bold" *ngIf="shouldDisplayIncorrect"> (Incorrect) </span>
<span class="mes-data large bold" *ngIf="shouldShowFault(item.outcome)"> (Incorrect) </span>
</div>
</div>
</ng-template>
Expand Down
1 change: 0 additions & 1 deletion src/app/pages/view-test-result/view-test-result.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
[dangerousFaults]="getDangerousFaults()"
[data]="testResult.testData"
[category]="testResult.category"
[displayIncorrectText]="displayIncorrectText"
[delegatedTest]="testResult['delegatedTest']"
>
</debrief-card>
Expand Down
5 changes: 0 additions & 5 deletions src/app/pages/view-test-result/view-test-result.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export class ViewTestResultPage extends BasePageComponent implements OnInit {
additionalErrorText: boolean;
reEnterEmailSubscription: Subscription;
reEnterEmail: RegeneratedEmails = null;
displayIncorrectText: boolean = false;

constructor(
public modalCtrl: ModalController,
Expand Down Expand Up @@ -91,10 +90,6 @@ export class ViewTestResultPage extends BasePageComponent implements OnInit {
.pipe(
map((response: HttpResponse<any>): string => response.body),
map((data) => this.testResult = this.compressionProvider.extract<TestResultSchemasUnion>(data)),
tap((testResult) => {
this.displayIncorrectText = this.faultSummaryProvider
.shouldShowIncorrect(testResult.testData, testResult.category as TestCategory);
}),
tap(async () => this.handleLoadingUI(false)),
catchError(async (err) => {
this.store$.dispatch(SaveLog({
Expand Down
Loading