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

feat(cb2-12179): only allow adr tests on adr vehicles carrying danger… #1618

Merged
merged 1 commit into from
Oct 10, 2024
Merged
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
11 changes: 11 additions & 0 deletions src/app/store/test-types/test-types.selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ function filterTestTypes(
vehicleSubclass,
numberOfWheelsDriven,
} = testResult;
const adrTestIds = ['50', '59', '60'];
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;
Expand Down Expand Up @@ -180,6 +181,16 @@ function filterTestTypes(
? filterHgvFirstTestIds.includes(testType.id)
: filterAllFirstTestIds.includes(testType.id))
)
// only allow ADR tests on ADR vehicles which carry dangerous goods
.filter((testType) => {
const isAdrTest = adrTestIds.includes(testType.id);
const isHGV = techRecord.techRecord_vehicleType === VehicleTypes.HGV;
const isTRL = techRecord.techRecord_vehicleType === VehicleTypes.TRL;
const isLGV = techRecord.techRecord_vehicleType === VehicleTypes.LGV;
const isADRVehicle = isHGV || isTRL || isLGV;

return isAdrTest && isADRVehicle ? techRecord.techRecord_adrDetails_dangerousGoods : true;
})
.map((testType: TestTypeCategory) => {
const newTestType = { ...testType } as TestTypeCategory;

Expand Down
Loading