operators not presented in Gantt if they have no schedule

parent 740a05b5
...@@ -29,6 +29,12 @@ class JSOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin): ...@@ -29,6 +29,12 @@ class JSOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
for element in resultElements: for element in resultElements:
if element['_class'] in self.OPERATOR_CLASS_SET: if element['_class'] in self.OPERATOR_CLASS_SET:
operatorId=element['id'] operatorId=element['id']
k=1
schedule=element['results'].get('schedule', [])
if schedule:
# add the operator in the task_dict # add the operator in the task_dict
task_dict[element['id']] = dict( task_dict[element['id']] = dict(
id=operatorId, id=operatorId,
...@@ -36,10 +42,6 @@ class JSOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin): ...@@ -36,10 +42,6 @@ class JSOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
type='operator', type='operator',
open=False) open=False)
k=1
schedule=element['results'].get('schedule', [])
if schedule:
for record in schedule: for record in schedule:
entranceTime=record['entranceTime'] entranceTime=record['entranceTime']
exitTime = record.get("exitTime", None) exitTime = record.get("exitTime", None)
...@@ -49,10 +51,20 @@ class JSOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin): ...@@ -49,10 +51,20 @@ class JSOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
except IndexError: except IndexError:
exitTime=maxSimTime exitTime=maxSimTime
k+=1 k+=1
task_dict[operatorId+record['stationId']+str(k)] = dict( task_id = record.get("task_id", None)
id=operatorId+record['stationId']+str(k), 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, parent=operatorId,
text=record['stationId'], text=text_to_display,
start_date=self.convertToRealWorldTime( start_date=self.convertToRealWorldTime(
entranceTime).strftime(date_format), entranceTime).strftime(date_format),
stop_date=self.convertToRealWorldTime( stop_date=self.convertToRealWorldTime(
...@@ -61,7 +73,6 @@ class JSOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin): ...@@ -61,7 +73,6 @@ class JSOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
entranceTime=entranceTime, entranceTime=entranceTime,
duration=exitTime-entranceTime, duration=exitTime-entranceTime,
) )
# return the result to the gadget # return the result to the gadget
result = data['result']['result_list'][-1] result = data['result']['result_list'][-1]
result[self.configuration_dict['output_id']] = dict( 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