Browse Source

Adjusting s curve

pull/2/head
Wahyu Ramadhan 2 years ago
parent
commit
04c2255a4f
  1. 13
      src/views/Dashboard/DashboardProject.js

13
src/views/Dashboard/DashboardProject.js

@ -248,7 +248,11 @@ const DashboardProject = () => {
const getSCurve = async () => { const getSCurve = async () => {
setIsReadySCurve(false); setIsReadySCurve(false);
const URL = `${BASE_OSPRO}/api/project/get-s-curve`; let URL = `${BASE_OSPRO}/api/project/get-s-curve`;
if(SCURVE && SCURVE == "1"){
URL = `${BASE_OSPRO}/api/project/get-linear-s-curve`;
}
const payload = { const payload = {
"project_id": PROJECT_ID.toString(), "project_id": PROJECT_ID.toString(),
"gantt_id": GANTT_ID.toString(), "gantt_id": GANTT_ID.toString(),
@ -285,7 +289,11 @@ const DashboardProject = () => {
let dates = result.data.data[0].data?.date; let dates = result.data.data[0].data?.date;
let n = dates.findIndex(element => new Date(now) < new Date(element[0])) - 1; 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) {
if(SCURVE && SCURVE == "1"){
planningProgress = result.data.data[0].data?.percentagePlan[result.data.data[0].data?.percentagePlan.length - 1];
} else {
planningProgress = result.data.data[0].data?.percentagePlan[n]; 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) {
@ -600,7 +608,8 @@ const DashboardProject = () => {
parentNames += " - "; parentNames += " - ";
parentNames += dataGanttParents.data.data[i].name; parentNames += dataGanttParents.data.data[i].name;
} }
return projectName + parentNames + " - " + dataGantt.data.data.name_version; return SCURVE && SCURVE == "1" ? projectName
: projectName + parentNames + " - " + dataGantt.data.data.name_version;
})() })()
: <SingleTextLoader />} : <SingleTextLoader />}
</div> </div>

Loading…
Cancel
Save