From 929f6ac2530e4f54ef5f8ff05855486f572e908a Mon Sep 17 00:00:00 2001 From: Samy Ouyahia Date: Tue, 19 Mar 2024 09:48:13 +0100 Subject: [PATCH] Fixed the way the close ups are displayed in VM --- .../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 723f270b4..680ad1aa8 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)