[hamster-applet] disallowing future facts



commit 24bc87f06712c66f4ad68adbe9e7afc46e914103
Author: Toms Bauģis <toms baugis gmail com>
Date:   Tue Jun 16 11:32:57 2009 +0100

    disallowing future facts

 hamster/db.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/hamster/db.py b/hamster/db.py
index 97b7c9d..f5abfc6 100644
--- a/hamster/db.py
+++ b/hamster/db.py
@@ -286,6 +286,10 @@ class Storage(hamster.storage.Storage):
     def __add_fact(self, activity_name, start_time = None, end_time = None):
         activity = stuff.parse_activity_input(activity_name)
         start_time = activity.start_time or start_time or datetime.datetime.now()
+        
+        if start_time > datetime.datetime.now():
+            return None #no facts in future, please
+        
         start_time = start_time.replace(microsecond = 0)
         end_time = activity.end_time or end_time
         if end_time:



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