Modified logic to account for tasks that are less than five minutes
This commit is contained in:
parent
52f9bb0f83
commit
34a5bc5bb2
|
@ -20,7 +20,7 @@ comment = re.compile("^\s*#") # regex for finding empty lines (and skipp
|
||||||
delim = re.compile(":\s{2}") # regex for splitting timestamp entry
|
delim = re.compile(":\s{2}") # regex for splitting timestamp entry
|
||||||
begin = re.compile("^Begin\s(?P<action>.*)\s*$")
|
begin = re.compile("^Begin\s(?P<action>.*)\s*$")
|
||||||
end = re.compile("^End\s{3}(?P<action>.*)\s*$")
|
end = re.compile("^End\s{3}(?P<action>.*)\s*$")
|
||||||
incident = re.compile("^(PDROP|CHG)-?\d+")
|
case = re.compile("^(PDROP|CHG)-?\d+")
|
||||||
|
|
||||||
for line in fileinput.input():
|
for line in fileinput.input():
|
||||||
if empty.match(line) or comment.match(line): # if the current line is empty
|
if empty.match(line) or comment.match(line): # if the current line is empty
|
||||||
|
@ -66,15 +66,18 @@ for act in sorted(start.keys()):
|
||||||
print >> sys.stderr, "ERROR: Missing a Begin"
|
print >> sys.stderr, "ERROR: Missing a Begin"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
sigma = 0
|
delta = 0
|
||||||
while (len(start[act]) > 0 and len(start[act]) > 0):
|
while (len(start[act]) > 0 and len(finish[act]) > 0):
|
||||||
beg = start[act].pop(0)
|
beg = start[act].pop(0)
|
||||||
en = finish[act].pop(0)
|
en = finish[act].pop(0)
|
||||||
sigma += en - beg
|
delta += en - beg
|
||||||
|
|
||||||
ind[act] = sigma
|
ind[act] = delta
|
||||||
gtot += sigma
|
gtot += delta
|
||||||
gtoth += nearest(sigma/3600)
|
if delta <= 300:
|
||||||
|
gtoth += 0.08
|
||||||
|
else:
|
||||||
|
gtoth += nearest(delta/3600.00)
|
||||||
|
|
||||||
ttot = 0
|
ttot = 0
|
||||||
utot = 0
|
utot = 0
|
||||||
|
@ -84,12 +87,15 @@ table = "{a:<50} {f:>10}"
|
||||||
for act in sorted(ind.keys()):
|
for act in sorted(ind.keys()):
|
||||||
#minutes = "{:d}min".format(int(ind[act]%3600/60))
|
#minutes = "{:d}min".format(int(ind[act]%3600/60))
|
||||||
#hrs = "{:d}hrs".format(int(nearest(ind[act]/3600)))
|
#hrs = "{:d}hrs".format(int(nearest(ind[act]/3600)))
|
||||||
fhrs = "{:.2f}hrs".format(nearest(ind[act]/3600))
|
if ind[act] <= 300:
|
||||||
|
fhrs = "{:.2f}hrs".format(0.08)
|
||||||
|
else:
|
||||||
|
fhrs = "{:.2f}hrs".format(nearest(ind[act]/3600.00))
|
||||||
#sec = "{:d}s".format(int(ind[act]))
|
#sec = "{:d}s".format(int(ind[act]))
|
||||||
|
|
||||||
#print table.format(a=act, s=sec, h=hrs, m=minutes, f=fhrs)
|
#print table.format(a=act, s=sec, h=hrs, m=minutes, f=fhrs)
|
||||||
print table.format(a=act, f=fhrs)
|
print table.format(a=act, f=fhrs)
|
||||||
if incident.match(act):
|
if case.match(act):
|
||||||
ttot += ind[act]
|
ttot += ind[act]
|
||||||
else:
|
else:
|
||||||
utot += ind[act]
|
utot += ind[act]
|
||||||
|
|
Loading…
Reference in New Issue