Use SettingDictToggle to document ENTRANCE_EXAMS

This commit is contained in:
Régis Behmo
2020-10-12 23:14:36 +02:00
parent 460f637fa7
commit 87b5463d42
10 changed files with 49 additions and 37 deletions

View File

@@ -76,7 +76,7 @@ from openedx.core.djangoapps.xmodule_django.models import NoneToEmptyManager
from openedx.core.djangolib.model_mixins import DeletableByUserValue
from student.signals import ENROLL_STATUS_CHANGE, ENROLLMENT_TRACK_UPDATED, UNENROLL_DONE
from track import contexts, segment
from util.milestones_helpers import is_entrance_exams_enabled
from openedx.core.toggles import ENTRANCE_EXAMS
from util.model_utils import emit_field_changed_events, get_changed_fields_dict
from util.query import use_read_replica_if_available
@@ -2659,7 +2659,7 @@ class EntranceExamConfiguration(models.Model):
Return True if given user can skip entrance exam for given course otherwise False.
"""
can_skip = False
if is_entrance_exams_enabled():
if ENTRANCE_EXAMS.is_enabled():
try:
record = EntranceExamConfiguration.objects.get(user=user, course_id=course_key)
can_skip = record.skip_entrance_exam

View File

@@ -18,6 +18,7 @@ from openedx.core.djangoapps.content.course_overviews.models import CourseOvervi
from openedx.core.lib.cache_utils import get_cache
from xmodule.modulestore.django import modulestore
NAMESPACE_CHOICES = {
'ENTRANCE_EXAM': 'entrance_exams'
}
@@ -33,7 +34,6 @@ REQUEST_CACHE_NAME = "milestones"
# .. toggle_creation_date: 2014-11-21
# TODO this should be moved to edx/edx-milestones
ENABLE_MILESTONES_APP = SettingDictToggle("FEATURES", "MILESTONES_APP", default=False, module_name=__name__)
ENABLE_ENTRANCE_EXAMS = SettingDictToggle("FEATURES", "ENTRANCE_EXAMS", default=False, module_name=__name__)
def get_namespace_choices():
@@ -43,14 +43,6 @@ def get_namespace_choices():
return NAMESPACE_CHOICES
def is_entrance_exams_enabled():
"""
Checks to see if the Entrance Exams feature is enabled
Use this operation instead of checking the feature flag all over the place
"""
return ENABLE_ENTRANCE_EXAMS.is_enabled()
def is_prerequisite_courses_enabled():
"""
Returns boolean indicating prerequisite courses enabled system wide or not.