aboutsummaryrefslogtreecommitdiff
path: root/src/web/views
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2016-01-28 22:47:36 +0100
committerFrançois Schmidts <francois.schmidts@gmail.com>2016-01-28 22:47:36 +0100
commit8e942f6f5695c4788328b4959527b30ff31e771d (patch)
tree1d6caa3d4b1d102ed804215d21bad8a04f9a00ff /src/web/views
parentslight redo of middle panel (diff)
downloadnewspipe-8e942f6f5695c4788328b4959527b30ff31e771d.tar.gz
newspipe-8e942f6f5695c4788328b4959527b30ff31e771d.tar.bz2
newspipe-8e942f6f5695c4788328b4959527b30ff31e771d.zip
redoing menu, sorting in place and not in python
Diffstat (limited to 'src/web/views')
-rw-r--r--src/web/views/views.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/web/views/views.py b/src/web/views/views.py
index 90836af1..84d1eacb 100644
--- a/src/web/views/views.py
+++ b/src/web/views/views.py
@@ -245,22 +245,18 @@ def get_menu():
categories = {c.id: c.dump() for c in CategoryController(g.user.id).read()}
categories[0] = {'name': 'No category', 'id': 0}
unread = ArticleController(g.user.id).count_by_feed(readed=False)
- feed_in_error = False
for cat_id in categories:
categories[cat_id]['unread'] = 0
categories[cat_id]['feeds'] = []
- for feed in FeedController(g.user.id).read():
- if feed.error_count > 3:
- feed_in_error = True
- feed = feed.dump()
+ feeds = {feed.id: feed.dump() for feed in FeedController(g.user.id).read()}
+ for feed_id, feed in feeds.items():
feed['category_id'] = feed['category_id'] or 0
feed['unread'] = unread.get(feed['id'], 0)
if feed.get('icon_url'):
feed['icon_url'] = url_for('icon.icon', url=feed['icon_url'])
categories[feed['category_id']]['unread'] += feed['unread']
- categories[feed['category_id']]['feeds'].append(feed)
- return jsonify(**{'categories': list(categories.values()),
- 'feed_in_error': feed_in_error,
+ categories[feed['category_id']]['feeds'].append(feed_id)
+ return jsonify(**{'feeds': feeds, 'categories': categories,
'all_unread_count': sum(unread.values())})
bgstack15