operators not presented in Gantt if they have no schedule

parent 740a05b5
......@@ -29,6 +29,12 @@ class JSOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
for element in resultElements:
if element['_class'] in self.OPERATOR_CLASS_SET:
operatorId=element['id']
k=1
schedule=element['results'].get('schedule', [])
if schedule:
# add the operator in the task_dict
task_dict[element['id']] = dict(
id=operatorId,
......@@ -36,10 +42,6 @@ class JSOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
type='operator',
open=False)
k=1
schedule=element['results'].get('schedule', [])
if schedule:
for record in schedule:
entranceTime=record['entranceTime']
exitTime = record.get("exitTime", None)
......@@ -49,10 +51,20 @@ class JSOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
except IndexError:
exitTime=maxSimTime
k+=1
task_dict[operatorId+record['stationId']+str(k)] = dict(
id=operatorId+record['stationId']+str(k),
task_id = record.get("task_id", None)
if not task_id:
task_id = record["stationId"]
text_to_display = task_id
else:
entityId = record.get("entityId", None)
if not entityId:
text_to_display = task_id + " " + record["stationId"]
else:
text_to_display = task_id + " " + record["stationId"] + " " + entityId
task_dict[operatorId+task_id+str(k)] = dict(
id=operatorId+task_id+str(k),
parent=operatorId,
text=record['stationId'],
text=text_to_display,
start_date=self.convertToRealWorldTime(
entranceTime).strftime(date_format),
stop_date=self.convertToRealWorldTime(
......@@ -61,7 +73,6 @@ class JSOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
entranceTime=entranceTime,
duration=exitTime-entranceTime,
)
# return the result to the gadget
result = data['result']['result_list'][-1]
result[self.configuration_dict['output_id']] = dict(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment