Commit e7533bc8 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Jérome Perrin

patch to correct shift pattern if it is in the form [[a,b],[b,c]]

parent f2744263
...@@ -1304,6 +1304,15 @@ def createObjectInterruptions(): ...@@ -1304,6 +1304,15 @@ def createObjectInterruptions():
if len(shift): if len(shift):
victim=Globals.findObjectById(element['id']) victim=Globals.findObjectById(element['id'])
shiftPattern=list(shift.get('shiftPattern', [])) shiftPattern=list(shift.get('shiftPattern', []))
# patch to correct if input has end of shift at the same time of start of next shift
# TODO check if the backend should be able to handle this
for index, element in enumerate(shiftPattern):
if element is shiftPattern[-1]:
break
next = shiftPattern[index + 1]
if element[1]==next[0]:
element[1]=next[1]
shiftPattern.remove(next)
endUnfinished=bool(int(shift.get('endUnfinished', 0))) endUnfinished=bool(int(shift.get('endUnfinished', 0)))
SS=ShiftScheduler(victim, shiftPattern, endUnfinished) SS=ShiftScheduler(victim, shiftPattern, endUnfinished)
G.ObjectInterruptionList.append(SS) G.ObjectInterruptionList.append(SS)
...@@ -1337,7 +1346,6 @@ def main(argv=[], input_data=None): ...@@ -1337,7 +1346,6 @@ def main(argv=[], input_data=None):
G.InputData=G.JSONFile.read() # pass the contents of the input file to the global var InputData G.InputData=G.JSONFile.read() # pass the contents of the input file to the global var InputData
else: else:
G.InputData = input_data G.InputData = input_data
start=time.time() # start counting execution time start=time.time() # start counting execution time
#read the input from the JSON file and create the line #read the input from the JSON file and create the line
......
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