Browse Source

Fixed math error in timetracker.py

master
Trey Blancher 5 months ago
parent
commit
5b1a4410e4
1 changed files with 8 additions and 8 deletions
  1. +8
    -8
      timetracker.py

+ 8
- 8
timetracker.py 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}"


Loading…
Cancel
Save