From 1c88bf7f4cefd9a7f144f023519c51ec8d4718db Mon Sep 17 00:00:00 2001 From: David Ly Date: Mon, 18 Mar 2024 23:50:18 +0100 Subject: [PATCH] fixed: updated closeUp filter --- .../DamageReport/hooks/useProcessInspection.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/inspection-report/src/components/DamageReport/hooks/useProcessInspection.js b/packages/inspection-report/src/components/DamageReport/hooks/useProcessInspection.js index 7e174ca67..7ffbba6dd 100644 --- a/packages/inspection-report/src/components/DamageReport/hooks/useProcessInspection.js +++ b/packages/inspection-report/src/components/DamageReport/hooks/useProcessInspection.js @@ -81,10 +81,12 @@ function getPictures(inspection) { } function getPartPictures(part, inspection) { - const closeUps = inspection.images.filter((image) => ( - image.image_type === 'close_up' - && image.detailed_viewpoint?.centers_on.includes(part.part_type) - )); + const closeUpImageIds = inspection.parts + .find((value) => value.part_type === part.part_type) + ?.related_images.filter((image) => image.base_image_type === 'close_up') + .map((image) => image.base_image_type); + const closeUps = inspection.images + .filter((image) => closeUpImageIds.includes(image.base_image_id)); const beautyShotsWithDamages = inspection.images.filter((image) => ( image.image_type === 'beauty_shot' && image.views?.some((view) => view.element_id === part.id)