Browse Source

Fix progress s curve

pull/2/head
Wahyu Ramadhan 2 years ago
parent
commit
803d4c3251
  1. 5
      src/views/Dashboard/DashboardProject.js

5
src/views/Dashboard/DashboardProject.js

@ -281,8 +281,11 @@ const DashboardProject = () => {
setEstAtCompletion(result.data.data[0].data.budget_control.estimated_at_completion?.toString()) setEstAtCompletion(result.data.data[0].data.budget_control.estimated_at_completion?.toString())
setCostDeviation(result.data.data[0].data.budget_control.cost_deviation?.toString()) setCostDeviation(result.data.data[0].data.budget_control.cost_deviation?.toString())
} }
let now = new Date().toISOString().slice(0, 10);
let dates = result.data.data[0].data?.date;
let n = dates.findIndex(element => new Date(now) < new Date(element[0])) - 1;
if (result.data.data.length > 0 && result.data.data[0].data?.percentagePlan && result.data.data[0].data?.percentagePlan.length > 0) { if (result.data.data.length > 0 && result.data.data[0].data?.percentagePlan && result.data.data[0].data?.percentagePlan.length > 0) {
planningProgress = result.data.data[0].data?.percentagePlan[result.data.data[0].data?.percentagePlan.length - 1]; planningProgress = result.data.data[0].data?.percentagePlan[n];
setPlanningProgress(planningProgress); setPlanningProgress(planningProgress);
} }
if (result.data.data.length > 0 && result.data.data[0].data?.percentageReal && result.data.data[0].data?.percentageReal.length > 0) { if (result.data.data.length > 0 && result.data.data[0].data?.percentageReal && result.data.data[0].data?.percentageReal.length > 0) {

Loading…
Cancel
Save