From 957d5407c71a5e53bf040428d173a317f1953c0a Mon Sep 17 00:00:00 2001 From: wixarm Date: Tue, 3 Feb 2026 16:42:17 +0330 Subject: [PATCH] update: samasat good sum --- index.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 7137975..ed7326b 100644 --- a/index.js +++ b/index.js @@ -2265,11 +2265,16 @@ app.post("/samasat-good-sum", async (req, res) => { response.on("end", () => { try { const jsonData = JSON.parse(data); - res.json( - jsonData.Data?.filter( - (option) => option?.TrackingStatus === 2, - )?.reduce((acc, item) => acc + Number(item?.GoodAmount || 0), 0), - ); + + const goodSum = jsonData.Data?.filter( + (option) => option?.TrackingStatus === 2, + )?.reduce((acc, item) => acc + Number(item?.GoodAmount || 0), 0); + + const loadingSum = jsonData.Data?.filter( + (option) => option?.TrackingStatus === 1, + )?.reduce((acc, item) => acc + Number(item?.GoodAmount || 0), 0); + + res.json({ goodSum, loadingSum }); } catch (error) { console.error("Error parsing JSON:", error.message); res