[Getan-commits] [PATCH 1 of 3] getan-report.py: ignores microseconds

Wald Commits scm-commit at wald.intevation.org
Fri Feb 3 17:35:59 CET 2017


# HG changeset patch
# User Bernhard Reiter <bernhard at intevation.de>
# Date 1486128775 -3600
# Node ID 9d4a8f7da935d458c0d2bb4209ccca48cb8bc053
# Parent  a487535e78449037c8698dfae5d70cc3a69c2e19
getan-report.py: ignores microseconds.

* makes the output more human readable.

diff -r a487535e7844 -r 9d4a8f7da935 scripts/getan-report.py
--- 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.


More information about the Getan-commits mailing list