hamster-applet r462 - trunk/hamster



Author: tbaugis
Date: Mon Sep  1 22:55:11 2008
New Revision: 462
URL: http://svn.gnome.org/viewvc/hamster-applet?rev=462&view=rev

Log:
if the fact's duration that must be stopped, is less than a minute, 
just remove it.  fixes bug 549564

Modified:
   trunk/hamster/db.py

Modified: trunk/hamster/db.py
==============================================================================
--- trunk/hamster/db.py	(original)
+++ trunk/hamster/db.py	Mon Sep  1 22:55:11 2008
@@ -129,14 +129,17 @@
         """
         return self.fetchone(query, (dt.date.today(), ))
 
-    def __touch_fact(self, activity, end_time = None):
-        id = activity['id']
-        query = """
-                   UPDATE facts
-                      SET end_time = ?
-                    WHERE id = ?
-        """
-        self.execute(query, (end_time, id))
+    def __touch_fact(self, fact, end_time):
+        # tasks under one minute do not count
+        if end_time - fact['start_time'] < datetime.timedelta(minutes = 1):
+            self.__remove_fact(fact['id'])
+        else:
+            query = """
+                       UPDATE facts
+                          SET end_time = ?
+                        WHERE id = ?
+            """
+            self.execute(query, (end_time, fact['id']))
 
     def __add_fact(self, activity_name, start_time = None, end_time = None):
         start_time = start_time or datetime.datetime.now()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]