From d8bb5345266922d93fce442573d40cfff846ff4d Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sun, 26 May 2024 14:40:59 +0200 Subject: [PATCH] fix: hull restriction filtering was too strict (#137) --- .../HardwareListing/HardwareListing.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/HardwareListing/HardwareListing.tsx b/src/components/HardwareListing/HardwareListing.tsx index a9e2141..742198d 100644 --- a/src/components/HardwareListing/HardwareListing.tsx +++ b/src/components/HardwareListing/HardwareListing.tsx @@ -275,11 +275,6 @@ export const HardwareListing = () => { attr.attributeID === eveData.attributeMapping.canFitShipType10 || attr.attributeID === eveData.attributeMapping.canFitShipType11, ); - /* If there is a restriction, check if this ship matches. */ - if (canFitShipType.length > 0) { - if (canFitShipType.filter((attr) => attr.value === shipType).length === 0) continue; - } - const canFitShipGroup = eveData.typeDogma[typeId]?.dogmaAttributes.filter( (attr) => attr.attributeID === eveData.attributeMapping.canFitShipGroup01 || @@ -303,9 +298,13 @@ export const HardwareListing = () => { attr.attributeID === eveData.attributeMapping.canFitShipGroup19 || attr.attributeID === eveData.attributeMapping.canFitShipGroup20, ); - /* If there is a restriction, check if this ship matches. */ - if (canFitShipGroup.length > 0) { - if (canFitShipGroup.filter((attr) => attr.value === shipGroup).length === 0) continue; + + /* If there is a fit restriction, check if this ship matches. */ + if (canFitShipType.length > 0 || canFitShipGroup.length > 0) { + const fitGroup = canFitShipGroup.find((attr) => attr.value === shipGroup); + const fitType = canFitShipType.find((attr) => attr.value === shipType); + + if (fitGroup === undefined && fitType === undefined) continue; } } } else {