From 04c2255a4f1ab3c75252c2b6aecac0658206e515 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Mon, 3 Jul 2023 12:43:57 +0700 Subject: [PATCH] Adjusting s curve --- src/views/Dashboard/DashboardProject.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/views/Dashboard/DashboardProject.js b/src/views/Dashboard/DashboardProject.js index de4fe89..3d1807c 100644 --- a/src/views/Dashboard/DashboardProject.js +++ b/src/views/Dashboard/DashboardProject.js @@ -248,7 +248,11 @@ const DashboardProject = () => { const getSCurve = async () => { 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 = { "project_id": PROJECT_ID.toString(), "gantt_id": GANTT_ID.toString(), @@ -285,7 +289,11 @@ const DashboardProject = () => { 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[n]; + 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]; + } setPlanningProgress(planningProgress); } 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 += 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; })() : }