Mercurial > getan
comparison scripts/getan-report.py @ 402:9d4a8f7da935
getan-report.py: ignores microseconds.
* makes the output more human readable.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Fri, 03 Feb 2017 14:32:55 +0100 |
parents | 0fd096670ae7 |
children | f656d9370085 |
comparison
equal
deleted
inserted
replaced
401:a487535e7844 | 402:9d4a8f7da935 |
---|---|
127 c.execute('select * from entries order by start_time') | 127 c.execute('select * from entries order by start_time') |
128 else: | 128 else: |
129 c.execute('select * from entries order by project_id') | 129 c.execute('select * from entries order by project_id') |
130 for e in c: | 130 for e in c: |
131 l.debug(e) | 131 l.debug(e) |
132 length = e[3] - e[2] | 132 # let us ignore microseconds |
133 start_time = e[2].replace(microsecond = 0) | |
134 stop_time = e[3].replace(microsecond = 0) | |
135 length = stop_time - start_time | |
133 | 136 |
134 desc = tasks[e[1]] | 137 desc = tasks[e[1]] |
135 | 138 |
136 if e[2] >= report_range_start and e[2] < report_range_end: | 139 if start_time >= report_range_start and start_time < report_range_end: |
137 if args.t: | 140 if args.t: |
138 print("{2}: {3} {4}\n\t\t\t{0} {1}". | 141 print("{2}: {3} {4}\n\t\t\t{0} {1}". |
139 format(e[2], e[3], desc, e[4], | 142 format(start_time, stop_time, desc, e[4], |
140 hhhmm_from_timedelta(length))) | 143 hhhmm_from_timedelta(length))) |
141 else: | 144 else: |
142 print("{0} {2}: {3} {4}". | 145 print("{0} {2}: {3} {4}". |
143 format(e[2], e[3], desc, e[4], | 146 format(start_time, stop_time, desc, e[4], |
144 hhhmm_from_timedelta(length))) | 147 hhhmm_from_timedelta(length))) |
145 if desc in factor: | 148 if desc in factor: |
146 # python3.1 does not allow timedelta division. | 149 # python3.1 does not allow timedelta division. |
147 # TODO: Make python3.1 save or update to python3.2. | 150 # TODO: Make python3.1 save or update to python3.2. |
148 # l.info("applying factor %f to entry %s" % (factor[desc], e)) | 151 # l.info("applying factor %f to entry %s" % (factor[desc], e)) |