Browse Source

Fix s curve

pull/1/head
Wahyu Ramadhan 2 years ago
parent
commit
9a25f8646b
  1. 23
      view-mode/function/overlaySCurve.js

23
view-mode/function/overlaySCurve.js

@ -34,13 +34,22 @@ function getSCurveData(){
"Content-Type": "application/json", "Content-Type": "application/json",
"Authorization": `Bearer ${token}` "Authorization": `Bearer ${token}`
}, },
url: `${base_url}project/get-linear-s-curve`, url: `${base_url}project/calculate-s-curve`,
type: "POST", type: "POST",
data:JSON.stringify(sCurvePayload), data:JSON.stringify(sCurvePayload),
success: function (data) { success: function (data) {
callback(data) callback(data)
} }
}); });
$.ajax({
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${token}`
},
url: `${base_url}project/s-curve-command`,
type: "POST",
data:JSON.stringify(sCurvePayload),
});
} else { } else {
$.ajax({ $.ajax({
headers: { headers: {
@ -93,7 +102,19 @@ function getProgressLine(){
getSCurveData(); getSCurveData();
var cumulativePlannedDurations = return_first.data[0].data.percentagePlan; var cumulativePlannedDurations = return_first.data[0].data.percentagePlan;
var cumulativeRealDurations = return_first.data[0].data.percentageReal; var cumulativeRealDurations = return_first.data[0].data.percentageReal;
var maxPlan = cumulativePlannedDurations[cumulativePlannedDurations.length - 1]
var maxReal = cumulativeRealDurations[cumulativeRealDurations.length - 1]
var dates = return_first.data[0].data.date; var dates = return_first.data[0].data.date;
if (maxReal > 100 || maxPlan > 100) {
var plannedDurations = cumulativePlannedDurations.map((item) => {
return item/maxPlan*100;
})
var realDurations = cumulativeRealDurations.map((item) => {
return item/maxPlan*100;
})
return {planned: plannedDurations, real: realDurations, dates: dates};
}
return {planned: cumulativePlannedDurations, real: cumulativeRealDurations, dates: dates}; return {planned: cumulativePlannedDurations, real: cumulativeRealDurations, dates: dates};
} }

Loading…
Cancel
Save