From b1b47325d7426599dc6f4767f26b1726b8edd81b Mon Sep 17 00:00:00 2001
From: Christian Boos <cboos@neuf.fr>
Date: Fri, 30 Apr 2010 22:55:20 +0200
Subject: [PATCH] #9282: use microsecond timestamps for storing and comparing lastread.
---
trac/timeline/templates/timeline.html | 9 ++++-----
trac/timeline/web_ui.py | 4 ++--
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/trac/timeline/templates/timeline.html b/trac/timeline/templates/timeline.html
index 77556fd..292ae36 100644
|
a
|
b
|
|
| 32 | 32 | </div> |
| 33 | 33 | </form> |
| 34 | 34 | |
| 35 | | <py:for each="day, events in groupby(events, key=lambda e: format_date(e.date))"> |
| | 35 | <py:for each="day, events in groupby(events, key=lambda e: format_date(e.date))" |
| | 36 | py:with="highlight = precision and precisedate and timedelta(0) <= (event.date - precisedate) < precision"> |
| 36 | 37 | <h2>${day}: ${day == today and _("Today") or day == yesterday and _("Yesterday") or None}</h2> |
| 37 | | <dl py:for="unread, events in groupby(events, key= |
| 38 | | lambda e: lastread and lastread < e.date.isoformat())" |
| | 38 | <dl py:for="unread, events in groupby(events, key=lambda e: lastread and lastread < e.dateuid)" |
| 39 | 39 | class="${unread and 'unread' or None}"> |
| 40 | | <py:for each="event in events" |
| 41 | | py:with="highlight = precision and precisedate and timedelta(0) <= (event.date - precisedate) < precision"> |
| | 40 | <py:for each="event in events"> |
| 42 | 41 | <dt class="${classes(event.kind, highlight=highlight, unread=unread)}"> |
| 43 | 42 | <a href="${event.render('url', context)}" py:choose=""> |
| 44 | 43 | <py:when test="event.author"><i18n:msg params="time, title, author"> |
diff --git a/trac/timeline/web_ui.py b/trac/timeline/web_ui.py
index a8ce4eb..da559c2 100644
|
a
|
b
|
class TimelineModule(Component): |
| 89 | 89 | |
| 90 | 90 | format = req.args.get('format') |
| 91 | 91 | maxrows = int(req.args.get('max', 0)) |
| 92 | | lastread = req.session.get('timeline.lastread', '') |
| | 92 | lastread = int(req.session.get('timeline.lastread', '0')) |
| 93 | 93 | |
| 94 | 94 | # Parse the from date and adjust the timestamp to the last second of |
| 95 | 95 | # the day |
| … |
… |
class TimelineModule(Component): |
| 208 | 208 | req.session['timeline.authors'] = authors |
| 209 | 209 | # store lastread |
| 210 | 210 | if events: |
| 211 | | lastviewed = events[0]['date'].isoformat() |
| | 211 | lastviewed = to_utimestamp(events[0]['date']) |
| 212 | 212 | req.session['timeline.lastread'] = max(lastread, lastviewed) |
| 213 | 213 | html_context = Context.from_request(req) |
| 214 | 214 | html_context.set_hints(wiki_flavor='oneliner', |