aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2020-04-16 12:25:17 -0500
committerzsloan2020-04-16 12:25:17 -0500
commit203ccbcc954a601931d2ab5a7522c89d5e2afd8c (patch)
treee29646698c7782acfad7afc107db2f56b8d86179
parent9db80a6f01da97b90dd8de7162af557ce062d3e4 (diff)
downloadgenenetwork2-203ccbcc954a601931d2ab5a7522c89d5e2afd8c.tar.gz
Made change that causes new traits to be at the top of a collection + prevents duplicates
-rw-r--r--wqflask/wqflask/user_session.py3
1 files changed, 2 insertions, 1 deletions
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)