Browse Source

Merge pull request 'staging' (#59) from staging into master

Reviewed-on: ordo/adw-frontend#59
pull/2/head
ibnu 1 year ago
parent
commit
74a686cf4e
  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