fix sending work_schedule

This commit is contained in:
Ziad-I
2024-07-02 20:11:26 +03:00
parent f60a6e0ca6
commit 56469b99c8
2 changed files with 11 additions and 10 deletions
@@ -1,5 +1,5 @@
// keeps track of blenders connected in form of
// shown:bool, work_sched: {}, task_json: {},
// shown:bool, work_schedule: {}, task_json: {},
const connectedClients = {};
let socket;
@@ -40,7 +40,7 @@ function handleBlenderConnect(blenderId) {
if (!connectedClients.hasOwnProperty(blenderId)) {
connectedClients[blenderId] = {
shown: false,
work_sched: {},
work_schedule: {},
task_json: {},
};
}
@@ -63,15 +63,15 @@ function handleGanttData(data) {
const filename = data["data"]["IFC_File"];
const ganttTasks = data["data"]["gantt_data"]["tasks"];
// const ganttWorkSched = data["data"]["gantt_data"]["work_schedule"];
const ganttWorkSched = {};
const ganttWorkSched = data["data"]["gantt_data"]["work_schedule"];
// const ganttWorkSched = {};
if (connectedClients.hasOwnProperty(blenderId)) {
if (!connectedClients[blenderId].shown) {
connectedClients[blenderId] = {
shown: true,
work_sched: ganttTasks,
task_json: ganttWorkSched,
task_json: ganttTasks,
work_schedule: ganttWorkSched,
};
addGanttElement(blenderId, ganttTasks, ganttWorkSched, filename);
} else {
@@ -80,8 +80,8 @@ function handleGanttData(data) {
} else {
connectedClients[blenderId] = {
shown: true,
work_sched: ganttTasks,
task_json: ganttWorkSched,
task_json: ganttTasks,
work_schedule: ganttWorkSched,
};
addGanttElement(blenderId, ganttTasks, ganttWorkSched, filename);
}
@@ -250,7 +250,7 @@ function editValue(list, task, event, cell, column) {
const ganttId = task.getGantt()["vDiv"].id;
const index = ganttId.indexOf("-") + 1;
const blenderId = ganttId.substring(index);
console.log("blenderId:", blenderId);
const workSchedId = connectedClients[blenderId].work_schedule.id;
// update data object reprsenting the task
const dataObj = task.getDataObject();
@@ -262,6 +262,7 @@ function editValue(list, task, event, cell, column) {
blenderId: blenderId,
operator: {
type: "editTask",
workScheduleId: workSchedId,
taskId: task.getOriginalID(),
column: column,
value: event.target.value,
+1 -1
View File
@@ -1544,7 +1544,7 @@ class Sequence(blenderbim.core.tool.Sequence):
def generate_gantt_browser_chart(
cls, task_json: list[dict[str, Any]], work_schedule: ifcopenshell.entity_instance
) -> None:
gantt_data = {"tasks": task_json, "word_schedule": json.dumps(work_schedule.get_info(recursive=True))}
gantt_data = {"tasks": task_json, "work_schedule": work_schedule.get_info(recursive=True)}
tool.Web.send_webui_data(extra_data=gantt_data, extra_data_key="gantt_data", event="gantt_data")
@classmethod