From b612e9cfb9930e03cee145bd0133f956bb3fcc3e Mon Sep 17 00:00:00 2001 From: Georgi 7DIGIT Date: Thu, 26 Sep 2024 14:43:54 +0300 Subject: [PATCH] Fix: organization_slots not iterable --- service/utils/helperFunctions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/utils/helperFunctions.js b/service/utils/helperFunctions.js index 80cb147..dbdd578 100644 --- a/service/utils/helperFunctions.js +++ b/service/utils/helperFunctions.js @@ -552,10 +552,11 @@ export const getEarliestAvailableSlot = async ( // Find the earliest upcoming availability slot that is not already in the upcoming consultations for (let j = 0; j < upcomingAvailability.length; j++) { let availability = upcomingAvailability[j]; + const organizationSlots = availability.organization_slots || []; const availabilityToMap = ( campaignId ? availability.campaign_slots - : [...availability.slots, ...availability.organization_slots] + : [...availability.slots, ...organizationSlots] ).sort((a, b) => { // sort by time asc if (a.time && b.time) {