From 203ccbcc954a601931d2ab5a7522c89d5e2afd8c Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 16 Apr 2020 12:25:17 -0500 Subject: Made change that causes new traits to be at the top of a collection + prevents duplicates --- wqflask/wqflask/user_session.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/user_session.py b/wqflask/wqflask/user_session.py index 53a43c40..71572c03 100644 --- a/wqflask/wqflask/user_session.py +++ b/wqflask/wqflask/user_session.py @@ -199,7 +199,8 @@ class UserSession(object): this_collection = self.get_collection_by_id(collection_id) updated_collection = this_collection - updated_traits = this_collection['members'] + traits_to_add + current_members_minus_new = [member for member in this_collection['members'] if member not in traits_to_add] + updated_traits = traits_to_add + current_members_minus_new updated_collection['members'] = updated_traits updated_collection['num_members'] = len(updated_traits) -- cgit v1.2.3