Skip to content

Commit 66768d8

Browse files
committed
Added new code to show bespoke LGV text
1 parent 3e6a722 commit 66768d8

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-16
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import {CategoryCode} from '@dvsa/mes-test-schema/categories/AM1';
2+
import {CustomProperties} from '../../../../domain/custom-properties';
3+
import {TestCategory} from '@dvsa/mes-test-schema/category-definitions/common/test-category';
4+
5+
export interface CatVocationalCustomProperties extends CustomProperties {
6+
showLGVText: boolean;
7+
}
8+
9+
export const getCustomPropertiesCatVocational = (
10+
category: CategoryCode
11+
): CatVocationalCustomProperties => {
12+
const showLGVFlag: boolean =
13+
category === TestCategory.C ||
14+
category === TestCategory.C1 ||
15+
category === TestCategory.CE ||
16+
category === TestCategory.C1E;
17+
18+
return {
19+
showLGVText: showLGVFlag,
20+
};
21+
};

src/functions/sendCandidateResults/application/service/custom-property-provider.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category';
22
import { TestResultSchemasUnion } from '@dvsa/mes-test-schema/categories';
3-
import {CategoryCode, ConductedLanguage, TestData as CatAMod1TestData} from '@dvsa/mes-test-schema/categories/AM1';
3+
import { CategoryCode, ConductedLanguage, TestData as CatAMod1TestData } from '@dvsa/mes-test-schema/categories/AM1';
44
import { TestData as CatCPCTestData } from '@dvsa/mes-test-schema/categories/CPC';
55
import { TestData as CatADI3TestData } from '@dvsa/mes-test-schema/categories/ADI3';
66
import { get } from 'lodash';
@@ -9,6 +9,7 @@ import { CustomProperties } from '../../domain/custom-properties';
99
import { getCustomPropertiesCatAMod1 } from './categories/AM1/custom-property-provider-cat-a-mod1';
1010
import { getCustomPropertiesCatCPC } from './categories/CPC/custom-property-provider-cat-cpc';
1111
import { getCustomPropertiesCatADI3 } from './categories/ADI3/custom-property-provider-cat-adi3';
12+
import { getCustomPropertiesCatVocational } from './categories/vocational/custom-property-provider-cat-vocational';
1213

1314
export interface ICustomPropertyProvider {
1415
getCustomProperties(testData: TestResultSchemasUnion | undefined): any;
@@ -28,6 +29,15 @@ export class CustomPropertyProvider implements ICustomPropertyProvider {
2829
const activityCode = get(testResult, 'activityCode');
2930

3031
switch (category) {
32+
case TestCategory.C:
33+
case TestCategory.C1:
34+
case TestCategory.CE:
35+
case TestCategory.C1E:
36+
case TestCategory.D:
37+
case TestCategory.D1:
38+
case TestCategory.DE:
39+
case TestCategory.D1E:
40+
return getCustomPropertiesCatVocational(category);
3141
case TestCategory.ADI3:
3242
case TestCategory.SC:
3343
const prn = get<TestResultSchemasUnion, string>(testResult, 'journalData.candidate.prn');

src/functions/sendCandidateResults/application/service/personalisation-provider.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import * as moment from 'moment';
2525
import 'moment/locale/cy';
2626
import { TestResultSchemasUnion } from '@dvsa/mes-test-schema/categories';
2727
import { isBikeCategory } from './category-provider';
28-
import {Correspondence} from '../../domain/template-id.model';
29-
import {TestCategory} from '@dvsa/mes-test-schema/category-definitions/common/test-category';
3028

3129
export interface IPersonalisationProvider {
3230

@@ -116,7 +114,6 @@ export class PersonalisationProvider implements IPersonalisationProvider {
116114
showEtaText: this.shouldShowEta(eta),
117115
showEtaVerbal: this.shouldShowEtaVerbal(eta),
118116
showEtaPhysical: this.shouldShowEtaPhysical(eta),
119-
showLGVText: this.shouldShowLGV(testresult.category),
120117
showProvLicenceRetainedByDvsa: provisionalLicenceProvided,
121118
showProvLicenceRetainedByDriver: !provisionalLicenceProvided,
122119
communicationMethod: commsMethod,
@@ -175,18 +172,6 @@ export class PersonalisationProvider implements IPersonalisationProvider {
175172
return !!(eta && eta.verbal);
176173
}
177174

178-
private shouldShowLGV(category: CategoryCode): boolean {
179-
switch (category) {
180-
case TestCategory.C:
181-
case TestCategory.C1:
182-
case TestCategory.CE:
183-
case TestCategory.C1E:
184-
return true;
185-
default:
186-
return false;
187-
}
188-
};
189-
190175
private formatDate(stringDate: string, language: ConductedLanguage): string {
191176
switch (language) {
192177
case 'Cymraeg':

0 commit comments

Comments
 (0)