Skip to content

Commit 094b345

Browse files
committed
update the gamification flag logic
1 parent 3d25288 commit 094b345

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

zeeguu/core/user_feature_toggles.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,26 @@ def _hide_recommendations(user):
8686

8787
# Gamification feature flag logic
8888
from .model.user import User
89+
from .model.cohort import Cohort
8990
from datetime import datetime, date
90-
91-
from zeeguu.core.model import user
9291
GAMIFICATION_START_DATE = date(2026, 4, 1)
9392
def _gamification(user: User):
9493
"""
95-
Enable general gamification features for users whose invitation code is exactly 'gamification'.
94+
Enable general gamification features for users whose invitation with the gamification invite code,
95+
or who are in the gamification cohort. This includes features like badges, friends, and leaderboards.
9696
"""
9797

98-
GAMIFICATION_INVITE_CODE = "gamification"
98+
GAMIFICATION_INVITE_CODE = "CD8HGKKJ"
9999
if user.is_dev:
100100
return True
101101

102-
# Only enable after the start date
103-
if not _has_gamification_started():
104-
return False
105-
106-
return user.invitation_code == GAMIFICATION_INVITE_CODE
102+
if user.invitation_code.lower() == GAMIFICATION_INVITE_CODE.lower():
103+
return True
104+
105+
# Find gamification cohort by invite code
106+
gamification_cohort = Cohort.find_by_code(GAMIFICATION_INVITE_CODE)
107+
if gamification_cohort and user.is_member_of_cohort(gamification_cohort.id):
108+
return True
107109

108-
def _has_gamification_started():
109-
return datetime.now().date() >= GAMIFICATION_START_DATE
110+
# Disabled for everyone else
111+
return False

0 commit comments

Comments
 (0)