Commit 32e0f392 authored by Georgios Dagkakis's avatar Georgios Dagkakis

correction in plugin

parent 79fabc97
......@@ -28,7 +28,7 @@ class BatchesOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
# loop in the results to find Operators
colorList=['blue','green','red',
'gold','black','white',
'gold','black','Aqua',
'DarkRed','Fuchsia','Gray',
'magenta','yellow','Olive',
'orange','purple','pink']
......@@ -43,6 +43,8 @@ class BatchesOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
i+=1
if i==len(colorList):
i=0
# set off-shift color to white
colorDict['off-shift']='white'
for element in resultElements:
if element['_class']=="Dream.Operator":
......@@ -56,21 +58,25 @@ class BatchesOperatorGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
schedule=copy(element['results']['schedule'])
# in the cases the operator exits and the enters in the same station merge those records
k=0
for record in schedule:
for nextRecord in schedule[k+1:]:
if nextRecord['stationId']==record['stationId'] and not record is schedule[-1]:
if nextRecord['stationId']==record['stationId']\
and nextRecord['entranceTime']==record['exitTime']\
and not record is schedule[-1]:
nextExitTime=nextRecord.get('exitTime',maxSimTime)
record['exitTime']=nextExitTime
schedule.remove(nextRecord)
else:
continue
k+=1
# print schedule
# loop though the records
k=1
for record in schedule:
entranceTime=record['entranceTime']
try:
exitTime=schedule[k]['entranceTime']
except IndexError:
exitTime=record.get('exitTime',None)
if not exitTime:
exitTime=maxSimTime
k+=1
task_dict[operatorId+record['stationId']+str(k)] = 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