Fixed math error in timetracker.py

This commit is contained in:
Trey Blancher 2020-07-27 10:52:24 -04:00
parent 148c83c604
commit 5b1a4410e4
1 changed files with 8 additions and 8 deletions

View File

@ -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
begin = re.compile("^Begin\s(?P<action>.*)\s*$")
end = re.compile("^End\s{3}(?P<action>.*)\s*$")
case = re.compile("^(PDROP|CHG)-?\d+")
#case = re.compile("^(PDROP|CHG)-?\d+")
for line in fileinput.input():
if empty.match(line) or comment.match(line): # if the current line is empty
@ -79,15 +79,15 @@ for act in sorted(start.keys()):
else:
gtoth += nearest(delta/3600.00)
ttot = 0
utot = 0
#ttot = 0
#utot = 0
table = "{a:<50} {f:>10}"
for act in sorted(ind.keys()):
#minutes = "{:d}min".format(int(ind[act]%3600/60))
#hrs = "{:d}hrs".format(int(nearest(ind[act]/3600)))
if ind[act] <= 300:
if ind[act] <= 288:
fhrs = "{:.2f}hrs".format(0.08)
else:
fhrs = "{:.2f}hrs".format(nearest(ind[act]/3600.00))
@ -95,10 +95,10 @@ for act in sorted(ind.keys()):
#print table.format(a=act, s=sec, h=hrs, m=minutes, f=fhrs)
print table.format(a=act, f=fhrs)
if case.match(act):
ttot += ind[act]
else:
utot += ind[act]
# if case.match(act):
# ttot += ind[act]
# else:
# utot += ind[act]
total = "{t:<20} {h:>10}"