From e7efbdcfdc12b378edcc62bcca5f624280ebcfb7 Mon Sep 17 00:00:00 2001 From: joseph le Date: Wed, 11 Oct 2023 16:49:40 +0700 Subject: [PATCH] Create function check status for other system --- app/utils/sendStatusOtherSystem.js | 38 +++++++++++++++++------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/app/utils/sendStatusOtherSystem.js b/app/utils/sendStatusOtherSystem.js index 25f1774..75eef5b 100644 --- a/app/utils/sendStatusOtherSystem.js +++ b/app/utils/sendStatusOtherSystem.js @@ -1014,26 +1014,30 @@ const checkMultipleRequest = async () => { }); await Promise.all(promises); - let listShipping = report.filter((i)=>i.group==="Shipping System").sort((a, b) => a.group.localeCompare(b.group)) - report = report.filter((i)=>i.group!=="Shipping System").concat(listShipping).sort((a, b) => a.group.localeCompare(b.group)) + let listShipping = report + .filter((i) => i.group === "Shipping System") + .sort((a, b) => a.group.localeCompare(b.group)); + report = report + .filter((i) => i.group !== "Shipping System") + .concat(listShipping) + .sort((a, b) => a.group.localeCompare(b.group)); let groupName = report?.sort((a, b) => a.group.localeCompare(b.group))[0] ?.group; let no = 0; content += "||**" + groupName + "**|||\n"; - report - ?.map((u, index) => { - no += 1; - if (u.group === groupName) { - content += - "|" + no + "|" + u.name + "|**" + time + "**|" + u.status + "|\n"; - } else { - no = 1; - groupName = u.group; - content += "||**" + groupName + "**|||\n"; - content += - "|" + no + "|" + u.name + "|**" + time + "**|" + u.status + "|\n"; - } - }); + report?.map((u, index) => { + no += 1; + if (u.group === groupName) { + content += + "|" + no + "|" + u.name + "|**" + time + "**|" + u.status + "|\n"; + } else { + no = 1; + groupName = u.group; + content += "||**" + groupName + "**|||\n"; + content += + "|" + no + "|" + u.name + "|**" + time + "**|" + u.status + "|\n"; + } + }); let params = { type: "stream", @@ -1051,7 +1055,7 @@ const checkMultipleRequest = async () => { }; client.messages.send(params); - // client.messages.send(params1); + client.messages.send(params1); allResponse += report .sort((a, b) => a.group.localeCompare(b.group)) .join("\n");