Skip to content

Commit

Permalink
feat(cb2-10711): First Test and First Test Retest must always be avai…
Browse files Browse the repository at this point in the history
…lable on provisional tech records for HGVs (#1535)

* feat(cb2-10711): always allow first test/first test retest on hgvs

* feat(cb2-10711): use correct test type list

* feat(cb2-10711): use correct list for filtering

* feat(cb2-10711): enable retests
  • Loading branch information
pbardy2000 authored Sep 2, 2024
1 parent b04b1d1 commit 87e85cb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/app/store/test-types/selectors/test-types.selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TestTypeCategory } from '@api/test-types/model/testTypeCategory';
import { TestTypesTaxonomy } from '@api/test-types/model/testTypesTaxonomy';
import { TechRecordSearchSchema } from '@dvsa/cvs-type-definitions/types/v3/tech-record/get/search';
import { TestResultModel } from '@models/test-results/test-result.model';
import { StatusCodes, V3TechRecordModel, VehicleSubclass } from '@models/vehicle-tech-record.model';
import { StatusCodes, V3TechRecordModel, VehicleSubclass, VehicleTypes } from '@models/vehicle-tech-record.model';
import { createSelector } from '@ngrx/store';
import { selectTechRecord, selectTechRecordHistory } from '@store/technical-records';
import { toEditOrNotToEdit } from '@store/test-records';
Expand Down Expand Up @@ -124,8 +124,9 @@ function filterTestTypes(
vehicleSubclass,
numberOfWheelsDriven,
} = testResult;
const filterAllFirstTestIds = ['41', '119', '120', '67', '103', '104', '51', '95', '82', '83', '65', '66'];
const filterHgvFirstTestIds = ['41', '119', '120', '67', '103', '104'];
const { techRecord_statusCode: statusCode } = techRecord;
const filterFirstTestIds: string[] = ['41', '95', '82', '83', '119', '120', '65', '66', '67', '103', '104', '51'];
return (
testTypes
.filter((testType) => !vehicleType || !testType.forVehicleType || testType.forVehicleType.includes(vehicleType))
Expand Down Expand Up @@ -175,7 +176,9 @@ function filterTestTypes(
!statusCode ||
statusCode !== StatusCodes.PROVISIONAL ||
!hasCurrentRecordInHistory ||
!filterFirstTestIds.includes(testType.id)
!(vehicleType === VehicleTypes.HGV
? filterHgvFirstTestIds.includes(testType.id)
: filterAllFirstTestIds.includes(testType.id))
)
.map((testType: TestTypeCategory) => {
const newTestType = { ...testType } as TestTypeCategory;
Expand Down

0 comments on commit 87e85cb

Please sign in to comment.