aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2023-05-31 10:48:13 -0400
committerBobby <[email protected]>2023-05-31 10:48:13 -0400
commit343115fbceceb2e7eb9e5743c06ed5bc9f7f45a2 (patch)
tree170dc5f0b90810a9559802f68835a8b4af9edced
parent3c58b9d0dbab2cb8f0cadc3c6d47312813209c96 (diff)
downloadthatcomputerscientist-343115fbceceb2e7eb9e5743c06ed5bc9f7f45a2.tar.xz
thatcomputerscientist-343115fbceceb2e7eb9e5743c06ed5bc9f7f45a2.zip
Fixing guest user number in production
-rw-r--r--middleware/uuidmiddleware.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/middleware/uuidmiddleware.py b/middleware/uuidmiddleware.py
index 9fe625f0..fc97cd58 100644
--- a/middleware/uuidmiddleware.py
+++ b/middleware/uuidmiddleware.py
@@ -1,5 +1,6 @@
import uuid
from django.core.cache import cache
+from django.conf import settings
class UserUUIDMiddleware:
# assign a uuid to the user if they don't have one
@@ -49,6 +50,10 @@ def userTrackingContextProcessor(request):
logged_in_users.append(user_data)
if user_data['is_staff'] == True:
admin_users.append(user_data)
+
+ # it looks like in production, the anonymous users is 1 more than expected
+ if not settings.DEBUG:
+ anonymous_users = anonymous_users[:-1]
return {
'anonymous_users': len(anonymous_users),