[hamster-applet/gnome-2-28] ignore seconds when trying to squeeze in fact



commit 9006ccc4b3c24a85c4d6f65eef6fba105c39d493
Author: Toms Bauģis <toms baugis gmail com>
Date:   Sun Nov 22 20:12:03 2009 +0000

    ignore seconds when trying to squeeze in fact

 hamster/db.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/hamster/db.py b/hamster/db.py
index b0f2520..e6ac020 100644
--- a/hamster/db.py
+++ b/hamster/db.py
@@ -294,7 +294,13 @@ class Storage(storage.Storage):
                 #we are in middle of a fact - truncate it to our start
                 self.execute("UPDATE facts SET end_time=? WHERE id=?",
                              (start_time, fact["id"]))
-                end_time = fact["end_time"]
+                
+                # hamster is second-aware, but the edit dialog naturally is not
+                # so when an ongoing task is being edited, the seconds get truncated
+                # and the start time will be before previous task's end time.
+                # so set our end time only if it is not about seconds
+                if fact["end_time"].replace(second = 0) > start_time:
+                    end_time = fact["end_time"]
             else: #otherwise we have found a task that is after us
                 end_time = fact["start_time"]
 



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