From aa06c83ecd4d36878ac0aadd75ab2bd461f44344 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 26 Jun 2020 14:47:10 -0500 Subject: Removed collections with zero members from list and count of user collections --- wqflask/wqflask/templates/collections/list.html | 2 ++ wqflask/wqflask/user_session.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/wqflask/wqflask/templates/collections/list.html b/wqflask/wqflask/templates/collections/list.html index c8705c7d..94e22c4d 100644 --- a/wqflask/wqflask/templates/collections/list.html +++ b/wqflask/wqflask/templates/collections/list.html @@ -42,6 +42,7 @@ {% for uc in collections %} + {% if uc.num_members > 0 %} {{ loop.index }} @@ -50,6 +51,7 @@ {{ uc.changed_timestamp }} {{ uc.num_members }} + {% endif %} {% endfor %} diff --git a/wqflask/wqflask/user_session.py b/wqflask/wqflask/user_session.py index ec6d4ae3..ba659fe5 100644 --- a/wqflask/wqflask/user_session.py +++ b/wqflask/wqflask/user_session.py @@ -167,7 +167,7 @@ class UserSession(object): def num_collections(self): """Number of user's collections""" - return len(self.user_collections) + return len([item for item in self.user_collections if item['num_members'] > 0]) def add_collection(self, collection_name, traits): """Add collection into Redis""" -- cgit v1.2.3