[hamster-applet] facts without end time before day before yesterday are treated as if they would have finished on mid



commit f1d52cb5a95280b7b70fc4222a20f1a6bae5bb23
Author: Toms Bauģis <toms baugis gmail com>
Date:   Sun Jun 14 16:21:06 2009 +0100

    facts without end time before day before yesterday are treated as if they would have finished on midnight

 hamster/db.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/hamster/db.py b/hamster/db.py
index 7003f3a..97b7c9d 100644
--- a/hamster/db.py
+++ b/hamster/db.py
@@ -390,8 +390,10 @@ class Storage(hamster.storage.Storage):
             # heuristics to assign tasks to proper days
             if fact["end_time"]:
                 fact_end_time = fact["end_time"]
-            else:
+            elif (today - fact["start_time"].date()) <= dt.timedelta(days=1):
                 fact_end_time = now
+            else:
+                fact_end_time = fact["start_time"].replace(hour=23, minute=59)
 
             fact_start_date = fact["start_time"].date() \
                 - dt.timedelta(1 if fact["start_time"].time() < split_time else 0)
@@ -417,7 +419,7 @@ class Storage(hamster.storage.Storage):
             if fact_date < date or fact_date > end_date:
                 # due to spanning we've jumped outside of given period
                 continue
-                                   
+
             f = dict(
                 id = fact["id"],
                 start_time = fact["start_time"],



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