changeset 401:a487535e7844

Adjusting starting datetime: update_entry() now also updatest start and end time.
author Bernhard Reiter <bernhard@intevation.de>
date Mon, 12 Sep 2016 11:06:46 +0200
parents 527168c08ae4
children 9d4a8f7da935
files getan/backend.py
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/getan/backend.py	Mon Sep 12 10:19:21 2016 +0200
+++ b/getan/backend.py	Mon Sep 12 11:06:46 2016 +0200
@@ -152,9 +152,13 @@
 
 MOVE_ENTRY = 'UPDATE entries SET project_id = ? WHERE id = ?'
 
-UPDATE_ENTRY = 'UPDATE entries SET description = ? WHERE id = ?'
+UPDATE_ENTRY = '''
+UPDATE entries
+    SET description = ?, start_time = ?, stop_time = ?
+    WHERE id = ?
+'''
 
-UPDATE_PROJECT = "UPDATE projects SET key = ?, description = ? WHERE id = ?"
+UPDATE_PROJECT = 'UPDATE projects SET key = ?, description = ? WHERE id = ?'
 
 logger = logging.getLogger()
 
@@ -342,9 +346,10 @@
         cur = None
         try:
             cur = self.con.cursor()
-            cur.execute(UPDATE_ENTRY, (entry.desc, entry.id))
+            cur.execute(UPDATE_ENTRY, (entry.desc, entry.start,
+                                       entry.end, entry.id))
             self.con.commit()
-            logger.debug("Updated entry: '%s' (%d)" % (entry.desc, entry.id))
+            logger.debug("Updated entry to: '%s'" % (entry))
         finally:
             close(cur)
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)