Browse Source

fix: assigned

pull/10/head
wahyun 4 months ago
parent
commit
3d1d7f6b4a
  1. 21
      src/views/Dashboard/DashboardProject.js

21
src/views/Dashboard/DashboardProject.js

@ -152,8 +152,7 @@ const DashboardProject = (props) => {
async function fetchData() { async function fetchData() {
await Promise.all([ await Promise.all([
getManpower(), getManpower(),
getAssignedHR(), getAssignedHR()
...(assignedHr.length > 0 ? [getActualHR()] : []),
]); ]);
} }
fetchData(); fetchData();
@ -219,9 +218,13 @@ const DashboardProject = (props) => {
today.isBetween(moment(item.start_date), moment(item.end_date)) today.isBetween(moment(item.start_date), moment(item.end_date))
) )
.map((item) => item.user_id); .map((item) => item.user_id);
setAssignedHrCount(assignedList.length); const uniqueUserIds = new Set(assignedList);
setAssignedHr(assignedList); setAssignedHrCount(uniqueUserIds.size);
if (assignedList.length > 0) {
getActualHR(assignedList)
}
} catch (error) { } 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[
result.data.data[0].data?.percentageReal.length - 1 result.data.data[0].data?.percentageReal.length - 1
]; ];
setActualProgress(actualProgress); setActualProgress(+(Math.round(actualProgress + "e+2") + "e-2"));
} }
selisihProgress = planningProgress - actualProgress; selisihProgress = planningProgress - actualProgress;
if (selisihProgress > 0 && selisihProgress <= 20) { if (selisihProgress > 0 && selisihProgress <= 20) {
@ -506,10 +509,10 @@ const DashboardProject = (props) => {
return; return;
} }
if (result.status !== 200) { if (result.status !== 200) {
NotificationManager.error( // NotificationManager.error(
`Get integration invoice failed, ${result.data.message}`, // `Get integration invoice failed, ${result.data.message}`,
"Failed" // "Failed"
); // );
setIsReadyIntegrationInvoice(true); setIsReadyIntegrationInvoice(true);
return; return;
} else if (result.status == 200 && result.data.data) { } else if (result.status == 200 && result.data.data) {

Loading…
Cancel
Save