aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2020-05-12 09:57:46 -0500
committerzsloan2020-05-12 09:57:46 -0500
commit2a2a14899beade4b2dff0c977162ddfe361841a4 (patch)
treead748ba8898452c5ae58a915a06053ef06a947ab
parent313b6e7d936f3982c9c6c83c909a8e68f7232ceb (diff)
downloadgenenetwork2-2a2a14899beade4b2dff0c977162ddfe361841a4.tar.gz
Replaced redis_user_id with user_id since there's no real need for the first if things are working correctly
-rw-r--r--wqflask/wqflask/user_session.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/wqflask/wqflask/user_session.py b/wqflask/wqflask/user_session.py
index 4c2305ba..50419146 100644
--- a/wqflask/wqflask/user_session.py
+++ b/wqflask/wqflask/user_session.py
@@ -119,10 +119,10 @@ class UserSession(object):
@property
def user_id(self):
"""Shortcut to the user_id"""
- if 'user_id' in self.record:
- return self.record['user_id']
- else:
- return ''
+ if 'user_id' not in self.record:
+ self.record['user_id'] = str(uuid.uuid4())
+
+ return self.record['user_id']
@property
def redis_user_id(self):
@@ -161,7 +161,7 @@ class UserSession(object):
"""List of user's collections"""
#ZS: Get user's collections if they exist
- collections = get_user_collections(self.redis_user_id)
+ collections = get_user_collections(self.user_id)
collections = [item for item in collections if item['name'] != "Your Default Collection"] + [item for item in collections if item['name'] == "Your Default Collection"] #ZS: Ensure Default Collection is last in list
return collections
@@ -277,7 +277,7 @@ class UserSession(object):
def update_collections(self, updated_collections):
collection_body = json.dumps(updated_collections)
- save_collections(self.redis_user_id, collection_body)
+ save_collections(self.user_id, collection_body)
def import_traits_to_user(self, anon_id):
collections = get_user_collections(anon_id)