Browse Source

Merge pull request 'Fix progress s curve' (#58) from dev-wahyu into staging

Reviewed-on: ordo/adw-frontend#58
pull/2/head
ibnu 2 years ago
parent
commit
3ca9915a8c
  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())
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) {
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);
}
if (result.data.data.length > 0 && result.data.data[0].data?.percentageReal && result.data.data[0].data?.percentageReal.length > 0) {

Loading…
Cancel
Save