From 9f605b74de84c1c819c8aefe81a4210c526494dc Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Thu, 19 Sep 2024 11:17:08 +0100 Subject: [PATCH 1/2] fix(cb2-11687): fix empty adr details --- .../adr-permitted-dangerous-goods.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/forms/custom-sections/adr-permitted-dangerous-goods/adr-permitted-dangerous-goods.component.ts b/src/app/forms/custom-sections/adr-permitted-dangerous-goods/adr-permitted-dangerous-goods.component.ts index 25471d92d..850ea4320 100644 --- a/src/app/forms/custom-sections/adr-permitted-dangerous-goods/adr-permitted-dangerous-goods.component.ts +++ b/src/app/forms/custom-sections/adr-permitted-dangerous-goods/adr-permitted-dangerous-goods.component.ts @@ -30,9 +30,9 @@ export class AdrPermittedDangerousGoodsComponent this.adrBodyType = newBodyTypeValue; if (this.adrBodyType?.includes('battery') || this.adrBodyType?.includes('tank')) { let currentValue: string[] = this.control?.value?.value; - if ( - currentValue.includes(ADRDangerousGood.EXPLOSIVES_TYPE_2) || - currentValue.includes(ADRDangerousGood.EXPLOSIVES_TYPE_3) + if ( currentValue && + (currentValue.includes(ADRDangerousGood.EXPLOSIVES_TYPE_2) || + currentValue.includes(ADRDangerousGood.EXPLOSIVES_TYPE_3)) ) { currentValue = currentValue.filter( (value) => value !== ADRDangerousGood.EXPLOSIVES_TYPE_3 && value !== ADRDangerousGood.EXPLOSIVES_TYPE_2 From 0ea35c97d2ab1d74643b6e4ab90364f1fc38d1bf Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Thu, 19 Sep 2024 11:20:26 +0100 Subject: [PATCH 2/2] fix(cb2-11687): lint fix --- .../adr-permitted-dangerous-goods.component.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/forms/custom-sections/adr-permitted-dangerous-goods/adr-permitted-dangerous-goods.component.ts b/src/app/forms/custom-sections/adr-permitted-dangerous-goods/adr-permitted-dangerous-goods.component.ts index 850ea4320..601872013 100644 --- a/src/app/forms/custom-sections/adr-permitted-dangerous-goods/adr-permitted-dangerous-goods.component.ts +++ b/src/app/forms/custom-sections/adr-permitted-dangerous-goods/adr-permitted-dangerous-goods.component.ts @@ -30,9 +30,10 @@ export class AdrPermittedDangerousGoodsComponent this.adrBodyType = newBodyTypeValue; if (this.adrBodyType?.includes('battery') || this.adrBodyType?.includes('tank')) { let currentValue: string[] = this.control?.value?.value; - if ( currentValue && + if ( + currentValue && (currentValue.includes(ADRDangerousGood.EXPLOSIVES_TYPE_2) || - currentValue.includes(ADRDangerousGood.EXPLOSIVES_TYPE_3)) + currentValue.includes(ADRDangerousGood.EXPLOSIVES_TYPE_3)) ) { currentValue = currentValue.filter( (value) => value !== ADRDangerousGood.EXPLOSIVES_TYPE_3 && value !== ADRDangerousGood.EXPLOSIVES_TYPE_2