[hamster-applet] updated conflict resolving so that in case if the end time was not specified, it would look also for
- From: Toms Baugis <tbaugis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hamster-applet] updated conflict resolving so that in case if the end time was not specified, it would look also for
- Date: Wed, 4 Aug 2010 15:07:37 +0000 (UTC)
commit f94a511949f431ed93a8098db4beca394856523b
Author: Toms Bauģis <toms baugis gmail com>
Date: Wed Aug 4 16:05:20 2010 +0100
updated conflict resolving so that in case if the end time was not specified, it would look also for previous ongoing and not try to fill until end of it either (so ongoing stays ongoing). bleh, a rubbish description of a commit, innit!
src/hamster/db.py | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/src/hamster/db.py b/src/hamster/db.py
index ce41cc3..a2e7dd2 100644
--- a/src/hamster/db.py
+++ b/src/hamster/db.py
@@ -372,29 +372,26 @@ class Storage(storage.Storage):
FROM facts a
LEFT JOIN activities b on b.id = a.activity_id
WHERE ((start_time < ? and end_time > ?)
+ OR (start_time > ? and start_time < ? and end_time is null)
OR (start_time > ? and start_time < ?))
ORDER BY start_time
LIMIT 1
"""
fact = self.fetchone(query, (start_time,
start_time,
+ start_time - dt.timedelta(seconds = 60 * 60 * 12),
+ start_time,
start_time,
start_time + dt.timedelta(seconds = 60 * 60 * 12)))
end_time = None
if fact:
- if fact["end_time"] and start_time > fact["start_time"]:
+ if start_time > fact["start_time"]:
#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"]))
- # 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]