Skip to content
Snippets Groups Projects
Unverified Commit 14a59c77 authored by Matthew Piatetsky's avatar Matthew Piatetsky Committed by GitHub
Browse files

Merge pull request #19424 from edx/REVE-156

remove username from holdback key
parents b2b92308 93f6dfa3
No related branches found
Tags release-2021-01-28-09.00
No related merge requests found
......@@ -110,14 +110,13 @@ class ContentTypeGatingConfig(StackedConfigurationModel):
return cls.enabled_for_course(course_key=course_key, target_datetime=timezone.now())
else:
# TODO: clean up as part of REV-100
experiment_data_holdback_key = EXPERIMENT_DATA_HOLDBACK_KEY.format(user)
is_in_holdback = False
if user and (user_variable_represents_correct_user):
try:
holdback_value = ExperimentData.objects.get(
user=user,
experiment_id=EXPERIMENT_ID,
key=experiment_data_holdback_key,
key=EXPERIMENT_DATA_HOLDBACK_KEY,
).value
is_in_holdback = holdback_value == 'True'
except ExperimentData.DoesNotExist:
......
......@@ -20,17 +20,16 @@ CONTENT_TYPE_GATING_FLAG = WaffleFlag(
)
EXPERIMENT_ID = 11
EXPERIMENT_DATA_HOLDBACK_KEY = 'holdback_{0}'
EXPERIMENT_DATA_HOLDBACK_KEY = 'holdback'
@receiver(ENROLL_STATUS_CHANGE)
def set_value_for_content_type_gating_holdback(sender, event=None, user=None, **kwargs): # pylint: disable=unused-argument
experiment_data_holdback_key = EXPERIMENT_DATA_HOLDBACK_KEY.format(user)
if event == EnrollStatusChange.enroll:
user_holdback_data = ExperimentData.objects.filter(
user=user,
experiment_id=EXPERIMENT_ID,
key=experiment_data_holdback_key,
key=EXPERIMENT_DATA_HOLDBACK_KEY,
)
user_holdback_data_already_set = user_holdback_data.exists()
if not user_holdback_data_already_set:
......@@ -45,7 +44,7 @@ def set_value_for_content_type_gating_holdback(sender, event=None, user=None, **
ExperimentData.objects.create(
user=user,
experiment_id=EXPERIMENT_ID,
key=experiment_data_holdback_key,
key=EXPERIMENT_DATA_HOLDBACK_KEY,
value=is_in_holdback
)
except (ExperimentKeyValue.DoesNotExist, AttributeError):
......
......@@ -130,7 +130,6 @@ class CourseDurationLimitConfig(StackedConfigurationModel):
return cls.enabled_for_course(course_key=course_key, target_datetime=timezone.now())
else:
# TODO: clean up as part of REV-100
experiment_data_holdback_key = EXPERIMENT_DATA_HOLDBACK_KEY.format(user)
is_in_holdback = False
no_masquerade = get_course_masquerade(user, course_key) is None
student_masquerade = is_masquerading_as_specific_student(user, course_key)
......@@ -139,7 +138,7 @@ class CourseDurationLimitConfig(StackedConfigurationModel):
holdback_value = ExperimentData.objects.get(
user=user,
experiment_id=EXPERIMENT_ID,
key=experiment_data_holdback_key,
key=EXPERIMENT_DATA_HOLDBACK_KEY,
).value
is_in_holdback = holdback_value == 'True'
except ExperimentData.DoesNotExist:
......
......@@ -221,7 +221,7 @@ class CourseExpirationTestCase(ModuleStoreTestCase):
ExperimentData.objects.create(
user=audit_student,
experiment_id=EXPERIMENT_ID,
key=EXPERIMENT_DATA_HOLDBACK_KEY.format(audit_student),
key=EXPERIMENT_DATA_HOLDBACK_KEY,
value='True'
)
CourseDurationLimitConfig.objects.create(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment