fix(analytics): detect PWA on subsequent requests, not just session creation
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Cookie pwa_mode=1 is set by JS after page load, so it's not available on the first request that creates the session. Now also check on subsequent requests and update is_pwa=True retroactively. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a9b78f9bf8
commit
dc2e91f00f
@ -98,6 +98,9 @@ def get_or_create_analytics_session():
|
||||
user_session.last_activity_at = datetime.now()
|
||||
if current_user.is_authenticated and not user_session.user_id:
|
||||
user_session.user_id = current_user.id
|
||||
# PWA cookie arrives on 2nd request (after JS sets it)
|
||||
if not user_session.is_pwa and request.cookies.get('pwa_mode') == '1':
|
||||
user_session.is_pwa = True
|
||||
db.commit()
|
||||
|
||||
return user_session.id
|
||||
|
||||
Loading…
Reference in New Issue
Block a user