diff --git a/src/views/Dashboard/DashboardProject.js b/src/views/Dashboard/DashboardProject.js index 551d630..0abf34c 100644 --- a/src/views/Dashboard/DashboardProject.js +++ b/src/views/Dashboard/DashboardProject.js @@ -152,8 +152,7 @@ const DashboardProject = (props) => { async function fetchData() { await Promise.all([ getManpower(), - getAssignedHR(), - ...(assignedHr.length > 0 ? [getActualHR()] : []), + getAssignedHR() ]); } fetchData(); @@ -219,9 +218,13 @@ const DashboardProject = (props) => { today.isBetween(moment(item.start_date), moment(item.end_date)) ) .map((item) => item.user_id); - setAssignedHrCount(assignedList.length); - setAssignedHr(assignedList); + const uniqueUserIds = new Set(assignedList); + setAssignedHrCount(uniqueUserIds.size); + if (assignedList.length > 0) { + getActualHR(assignedList) + } } catch (error) { + console.error("Failed to get assigned HR:", error); } }; @@ -439,7 +442,7 @@ const DashboardProject = (props) => { result.data.data[0].data?.percentageReal[ result.data.data[0].data?.percentageReal.length - 1 ]; - setActualProgress(actualProgress); + setActualProgress(+(Math.round(actualProgress + "e+2") + "e-2")); } selisihProgress = planningProgress - actualProgress; if (selisihProgress > 0 && selisihProgress <= 20) { @@ -506,10 +509,10 @@ const DashboardProject = (props) => { return; } if (result.status !== 200) { - NotificationManager.error( - `Get integration invoice failed, ${result.data.message}`, - "Failed" - ); + // NotificationManager.error( + // `Get integration invoice failed, ${result.data.message}`, + // "Failed" + // ); setIsReadyIntegrationInvoice(true); return; } else if (result.status == 200 && result.data.data) {