Commit 9828b6bc authored by Georgios Dagkakis's avatar Georgios Dagkakis

if elements in shift pattern or skills start or end with space strip ther

parent 0ee0d77e
...@@ -23,6 +23,10 @@ class BatchesOperatorBreaks(plugin.InputPreparationPlugin, TimeSupportMixin): ...@@ -23,6 +23,10 @@ class BatchesOperatorBreaks(plugin.InputPreparationPlugin, TimeSupportMixin):
continue continue
date=strptime(row[0], '%Y/%m/%d') date=strptime(row[0], '%Y/%m/%d')
operators=row[1].split(',') operators=row[1].split(',')
# if element has spaces in beginning or in end remove them
operators=self.stripStringsOfList(operators)
i=4 i=4
while row[i] not in ['', None]: while row[i] not in ['', None]:
breakStart=self.convertToSimulationTime(strptime("%s %s" % (row[0], row[i]), '%Y/%m/%d %H:%M')) breakStart=self.convertToSimulationTime(strptime("%s %s" % (row[0], row[i]), '%Y/%m/%d %H:%M'))
...@@ -56,8 +60,5 @@ class BatchesOperatorBreaks(plugin.InputPreparationPlugin, TimeSupportMixin): ...@@ -56,8 +60,5 @@ class BatchesOperatorBreaks(plugin.InputPreparationPlugin, TimeSupportMixin):
] ]
] ]
} }
# import json
# outputJSONString=json.dumps(data['graph']['node'], indent=5)
# outputJSONFile=open('h.json', mode='w')
# outputJSONFile.write(outputJSONString)
return data return data
...@@ -27,6 +27,9 @@ class ReadSkilledOperators(plugin.InputPreparationPlugin): ...@@ -27,6 +27,9 @@ class ReadSkilledOperators(plugin.InputPreparationPlugin):
continue continue
skills=PBitem[1].split(',') skills=PBitem[1].split(',')
skills = filter(bool, skills) skills = filter(bool, skills)
# if element has spaces in beginning or in end remove them
skills=self.stripStringsOfList(skills)
newSkills=[] newSkills=[]
for n_id,n in node.iteritems(): for n_id,n in node.iteritems():
technology=n.get('technology',None) technology=n.get('technology',None)
......
...@@ -47,6 +47,14 @@ class Plugin(object): ...@@ -47,6 +47,14 @@ class Plugin(object):
# return the average of a list # return the average of a list
def getAverage(self, value_list): def getAverage(self, value_list):
return sum(value_list) / float(len(value_list)) return sum(value_list) / float(len(value_list))
# takes a list of strings and removes spaces in the beginning or end
def stripStringsOfList(self, inputList):
i=0
for element in inputList:
inputList[i]=element.strip()
i+=1
return inputList
# return the standard deviation of a list # return the standard deviation of a list
def getStDev(self, value_list): def getStDev(self, value_list):
......
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