From 4c76e4d929bc9233075f040ebe5fcb57fb17ee7c Mon Sep 17 00:00:00 2001 From: "MSI\\2Fi" Date: Fri, 30 Aug 2024 17:10:34 +0800 Subject: [PATCH] Fix team selection not align with optput result --- .../ResourceOverconsumptionReport.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/ResourceOverconsumptionReport/ResourceOverconsumptionReport.tsx b/src/components/ResourceOverconsumptionReport/ResourceOverconsumptionReport.tsx index c29038c..b75505c 100644 --- a/src/components/ResourceOverconsumptionReport/ResourceOverconsumptionReport.tsx +++ b/src/components/ResourceOverconsumptionReport/ResourceOverconsumptionReport.tsx @@ -83,9 +83,15 @@ return ( status: "All", lowerLimit: 0.9 } - if (query.team.length > 0 && query.team.toLocaleLowerCase() !== "all") { - index = teamCombo.findIndex(team => team === query.team) - postData.teamId = team[index].id + if (query.team.length > 0 && query.team.toLocaleLowerCase() !== "all") { + // index = teamCombo.findIndex(team => team === query.team) + // console.log(index) + // console.log(teamCombo) + // console.log(team) + // console.log(team.find(team => query.team === `${team.code} - Team ${team.staffName}`)?.id) + const teamId = team.find(team => query.team === `${team.code} - Team ${team.staffName}`)?.id + // postData.teamId = team.sort()[index].id + postData.teamId = teamId } if (Boolean(query.lowerLimit)) { postData.lowerLimit = query.lowerLimit/100