From 3498d35583d41f30c1240531d4f2c0604f4d37f7 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 26 Aug 2024 16:29:13 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=BF=BD=E7=95=A5=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=88=BF=E5=9E=8B=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/helper/heytripDataHelper.js | 2 +- server/services/heytripService.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/helper/heytripDataHelper.js b/server/helper/heytripDataHelper.js index 6236a44..d969803 100644 --- a/server/helper/heytripDataHelper.js +++ b/server/helper/heytripDataHelper.js @@ -216,7 +216,7 @@ const scoresMapper = (sourceName, hotelId, scores, lgcObj) => scores.map((item) const resolveDetails = (res, lgcObj) => { return res.reduce( (rd, c) => { - if (isEmpty(c.HotelName) && isEmpty(c.LocaleName)) { + if ((isEmpty(c.HotelName) && isEmpty(c.LocaleName)) || isEmpty(c.Rooms)) { return rd; } rd.info.push(infoDataMapper(c)); diff --git a/server/services/heytripService.js b/server/services/heytripService.js index 31d6d5c..7601228 100644 --- a/server/services/heytripService.js +++ b/server/services/heytripService.js @@ -483,7 +483,7 @@ class Heytrip { }; const _quoteRes = await Availability(paramBody); const quoteRes = resolveRatePlans(_quoteRes); - const roomsQuote = quoteRes.map((row) => ({...row, ...roomMappedByID[row.RoomId]})); + const roomsQuote = quoteRes.map((row) => ({...row, ...(roomMappedByID[row.RoomId] || {})})); this.writeHeytripRequestLog({ action: 'heytripAvailability',