From f00ca4f23b73c1e46a2921717d4eee71d5155100 Mon Sep 17 00:00:00 2001 From: kjwon15 Date: Wed, 22 Jan 2014 02:32:40 +0900 Subject: [PATCH] mark all as read which is ONLY shown in screen #28 --- earthreader/web/app.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/earthreader/web/app.py b/earthreader/web/app.py index 57bec52..0b7279e 100644 --- a/earthreader/web/app.py +++ b/earthreader/web/app.py @@ -727,6 +727,8 @@ def category_entries(category_id): title=category_id.split('/')[-1][1:] or app.config['ALLFEED'], entries=entries, read_url=url_for('read_all_entries', category_id=category_id, + #FIXME: use Entry.updated_at instead of from json data. + last_updated=entries[0]['updated'], _external=True), next_url=next_url ) @@ -845,12 +847,16 @@ def read_all_entries(category_id='', feed_id=None): cursor = Cursor(category_id) feed_ids = [sub.feed_id for sub in cursor.recursive_subscriptions] + codec = Rfc3339() + last_updated = codec.decode(request.args.get('last_updated')) + for feed_id in feed_ids: try: with get_stage() as stage: feed = stage.feeds[feed_id] for entry in feed.entries: - entry.read = True + if entry.updated_at <= last_updated: + entry.read = True stage.feeds[feed_id] = feed except KeyError: if feed_id: