Browse Source

compare rendered data with response

pull/1/head
wahyu 1 year ago
parent
commit
b9b28bb1f8
  1. 26
      edit-mode/function/function.js
  2. 6
      edit-mode/function/ganttSettings.js
  3. 2
      edit-mode/function/restActivityLink.js

26
edit-mode/function/function.js

@ -367,6 +367,32 @@ function setGanttOpen() {
localStorage.setItem('ganttOpen', JSON.stringify(ganttOpen));
}
function compareData(data){
expandTask();
var allTasks = [];
var taskCount = gantt.getTaskCount();
for (var i = 0; i < taskCount; i++) {
var task = gantt.getTaskByIndex(i);
allTasks.push(task);
}
allTasks.forEach((task, index) => {
if (task.start_date != data.data[index].start_date) {
gantt.getTask(task.id).start_date = task.start_date;
}
if (task.end_date != data.data[index].end_date) {
gantt.getTask(task.id).end_date = task.end_date;
}
if (task.planned_start != data.data[index].planned_start) {
gantt.getTask(task.id).planned_start = task.planned_start;
}
if (task.planned_end != data.data[index].planned_end) {
gantt.getTask(task.id).planned_end = task.planned_end;
}
gantt.updateTask(task.id);
});
}
function getGanttOpen() {
let ganttOpen = localStorage.getItem('ganttOpen');
if (ganttOpen) {

6
edit-mode/function/ganttSettings.js

@ -350,7 +350,7 @@ function setBaseline() {
});
}
async function setBaselineAPI() {
async function importUpdate() {
expandTask();
var allTasks = [];
var taskCount = gantt.getTaskCount();
@ -381,6 +381,10 @@ async function setBaselineAPI() {
text: "Update import gagal"
});
});
}
async function setBaselineAPI() {
await importUpdate();
const res = await axiosInstance
.get(ACTIVITY_SET_BASELINE_URL, HEADER)
.then(res => res)

2
edit-mode/function/restActivityLink.js

@ -40,6 +40,7 @@ gantt.ajax.get({
gantt.silent(function () {
// updateLinksLag(data);
gantt.parse(data);
compareData(data);
getGanttOpen();
gantt.parse(data);
earliest = getEarliestTaskDate();
@ -93,6 +94,7 @@ function refresData(id) {
gantt.silent(function () {
// updateLinksLag(data);
gantt.parse(data);
compareData(data);
getGanttOpen();
gantt.parse(data);
earliest = getEarliestTaskDate();

Loading…
Cancel
Save