changeset 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 a487535e7844
children f656d9370085
files scripts/getan-report.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/getan-report.py	Mon Sep 12 11:06:46 2016 +0200
+++ b/scripts/getan-report.py	Fri Feb 03 14:32:55 2017 +0100
@@ -129,18 +129,21 @@
         c.execute('select * from entries order by project_id')
     for e in c:
         l.debug(e)
-        length = e[3] - e[2]
+        # let us ignore microseconds
+        start_time = e[2].replace(microsecond = 0)
+        stop_time = e[3].replace(microsecond = 0)
+        length = stop_time - start_time
 
         desc = tasks[e[1]]
 
-        if e[2] >= report_range_start and e[2] < report_range_end:
+        if start_time >= report_range_start and start_time < report_range_end:
             if args.t:
                 print("{2}: {3} {4}\n\t\t\t{0} {1}".
-                      format(e[2], e[3], desc, e[4],
+                      format(start_time, stop_time, desc, e[4],
                              hhhmm_from_timedelta(length)))
             else:
                 print("{0} {2}: {3} {4}".
-                      format(e[2], e[3], desc, e[4],
+                      format(start_time, stop_time, desc, e[4],
                              hhhmm_from_timedelta(length)))
             if desc in factor:
                 # python3.1 does not allow timedelta division.
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)