[Getan-commits] [PATCH] Updates "All project" time when the entrie time is adjusted

Wald Commits scm-commit at wald.intevation.org
Fri May 11 14:31:04 CEST 2018


# HG changeset patch
# User Magnus Schieder <mschieder at intevation.de>
# Date 1526041668 -7200
# Node ID 950bfe89ec3da63d4cbf77e2495d2e79a78a266e
# Parent  217630a03b583bdb782525a3c9a1b3b5fe9d112a
Updates "All project" time when the entrie time is adjusted.
Displays the correct total time.

diff -r 217630a03b58 -r 950bfe89ec3d getan/nodes.py
--- a/getan/nodes.py	Wed May 09 19:06:20 2018 +0200
+++ b/getan/nodes.py	Fri May 11 14:27:48 2018 +0200
@@ -118,6 +118,7 @@
 
     def _get_time(self):
         if self.mode == self.MODES[0]:
+            self.item.update_total()
             return self.item.total
         if self.mode == self.MODES[1]:
             return self.item.year()
diff -r 217630a03b58 -r 950bfe89ec3d getan/project.py
--- a/getan/project.py	Wed May 09 19:06:20 2018 +0200
+++ b/getan/project.py	Fri May 11 14:27:48 2018 +0200
@@ -32,6 +32,12 @@
         self.stop = None
         self.open= None
 
+    def update_total(self):
+        total = 0
+        for entry in self.entries:
+            total += (entry.end - entry.start).seconds
+        self.total = total
+
     def year(self):
         total = 0
         now = datetime.now()
diff -r 217630a03b58 -r 950bfe89ec3d getan/states.py
--- a/getan/states.py	Wed May 09 19:06:20 2018 +0200
+++ b/getan/states.py	Fri May 11 14:27:48 2018 +0200
@@ -921,6 +921,7 @@
         self.controller.update_entry(entry)
         self.view.node_in_focus().update()
         self.controller.view.proj_list.update_rows()
+        self.controller.project_view.show_total_time()
         return self.exit()
 
     def exit(self):


More information about the Getan-commits mailing list