mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 11:06:51 +00:00
fix sending work_schedule
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// keeps track of blenders connected in form of
|
// keeps track of blenders connected in form of
|
||||||
// shown:bool, work_sched: {}, task_json: {},
|
// shown:bool, work_schedule: {}, task_json: {},
|
||||||
const connectedClients = {};
|
const connectedClients = {};
|
||||||
let socket;
|
let socket;
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ function handleBlenderConnect(blenderId) {
|
|||||||
if (!connectedClients.hasOwnProperty(blenderId)) {
|
if (!connectedClients.hasOwnProperty(blenderId)) {
|
||||||
connectedClients[blenderId] = {
|
connectedClients[blenderId] = {
|
||||||
shown: false,
|
shown: false,
|
||||||
work_sched: {},
|
work_schedule: {},
|
||||||
task_json: {},
|
task_json: {},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -63,15 +63,15 @@ function handleGanttData(data) {
|
|||||||
|
|
||||||
const filename = data["data"]["IFC_File"];
|
const filename = data["data"]["IFC_File"];
|
||||||
const ganttTasks = data["data"]["gantt_data"]["tasks"];
|
const ganttTasks = data["data"]["gantt_data"]["tasks"];
|
||||||
// const ganttWorkSched = data["data"]["gantt_data"]["work_schedule"];
|
const ganttWorkSched = data["data"]["gantt_data"]["work_schedule"];
|
||||||
const ganttWorkSched = {};
|
// const ganttWorkSched = {};
|
||||||
|
|
||||||
if (connectedClients.hasOwnProperty(blenderId)) {
|
if (connectedClients.hasOwnProperty(blenderId)) {
|
||||||
if (!connectedClients[blenderId].shown) {
|
if (!connectedClients[blenderId].shown) {
|
||||||
connectedClients[blenderId] = {
|
connectedClients[blenderId] = {
|
||||||
shown: true,
|
shown: true,
|
||||||
work_sched: ganttTasks,
|
task_json: ganttTasks,
|
||||||
task_json: ganttWorkSched,
|
work_schedule: ganttWorkSched,
|
||||||
};
|
};
|
||||||
addGanttElement(blenderId, ganttTasks, ganttWorkSched, filename);
|
addGanttElement(blenderId, ganttTasks, ganttWorkSched, filename);
|
||||||
} else {
|
} else {
|
||||||
@@ -80,8 +80,8 @@ function handleGanttData(data) {
|
|||||||
} else {
|
} else {
|
||||||
connectedClients[blenderId] = {
|
connectedClients[blenderId] = {
|
||||||
shown: true,
|
shown: true,
|
||||||
work_sched: ganttTasks,
|
task_json: ganttTasks,
|
||||||
task_json: ganttWorkSched,
|
work_schedule: ganttWorkSched,
|
||||||
};
|
};
|
||||||
addGanttElement(blenderId, ganttTasks, ganttWorkSched, filename);
|
addGanttElement(blenderId, ganttTasks, ganttWorkSched, filename);
|
||||||
}
|
}
|
||||||
@@ -250,7 +250,7 @@ function editValue(list, task, event, cell, column) {
|
|||||||
const ganttId = task.getGantt()["vDiv"].id;
|
const ganttId = task.getGantt()["vDiv"].id;
|
||||||
const index = ganttId.indexOf("-") + 1;
|
const index = ganttId.indexOf("-") + 1;
|
||||||
const blenderId = ganttId.substring(index);
|
const blenderId = ganttId.substring(index);
|
||||||
console.log("blenderId:", blenderId);
|
const workSchedId = connectedClients[blenderId].work_schedule.id;
|
||||||
|
|
||||||
// update data object reprsenting the task
|
// update data object reprsenting the task
|
||||||
const dataObj = task.getDataObject();
|
const dataObj = task.getDataObject();
|
||||||
@@ -262,6 +262,7 @@ function editValue(list, task, event, cell, column) {
|
|||||||
blenderId: blenderId,
|
blenderId: blenderId,
|
||||||
operator: {
|
operator: {
|
||||||
type: "editTask",
|
type: "editTask",
|
||||||
|
workScheduleId: workSchedId,
|
||||||
taskId: task.getOriginalID(),
|
taskId: task.getOriginalID(),
|
||||||
column: column,
|
column: column,
|
||||||
value: event.target.value,
|
value: event.target.value,
|
||||||
|
|||||||
@@ -1544,7 +1544,7 @@ class Sequence(blenderbim.core.tool.Sequence):
|
|||||||
def generate_gantt_browser_chart(
|
def generate_gantt_browser_chart(
|
||||||
cls, task_json: list[dict[str, Any]], work_schedule: ifcopenshell.entity_instance
|
cls, task_json: list[dict[str, Any]], work_schedule: ifcopenshell.entity_instance
|
||||||
) -> None:
|
) -> 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")
|
tool.Web.send_webui_data(extra_data=gantt_data, extra_data_key="gantt_data", event="gantt_data")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user