Merge pull request #10308 from edx/ziafazal/SOL-1332
SOL-1332: use a generic function to check if entrance_exam feature is enabled or not
This commit is contained in:
@@ -52,6 +52,7 @@ import lms.lib.comment_client as cc
|
||||
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
|
||||
from util.model_utils import emit_field_changed_events, get_changed_fields_dict
|
||||
from util.query import use_read_replica_if_available
|
||||
from util.milestones_helpers import is_entrance_exams_enabled
|
||||
|
||||
|
||||
UNENROLL_DONE = Signal(providing_args=["course_enrollment", "skip_refund"])
|
||||
@@ -1896,7 +1897,7 @@ class EntranceExamConfiguration(models.Model):
|
||||
Return True if given user can skip entrance exam for given course otherwise False.
|
||||
"""
|
||||
can_skip = False
|
||||
if settings.FEATURES.get('ENTRANCE_EXAMS', False):
|
||||
if is_entrance_exams_enabled():
|
||||
try:
|
||||
record = EntranceExamConfiguration.objects.get(user=user, course_id=course_key)
|
||||
can_skip = record.skip_entrance_exam
|
||||
|
||||
@@ -24,6 +24,14 @@ 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 settings.FEATURES.get('ENTRANCE_EXAMS', False)
|
||||
|
||||
|
||||
def is_prerequisite_courses_enabled():
|
||||
"""
|
||||
Returns boolean indicating prerequisite courses enabled system wide or not.
|
||||
|
||||
Reference in New Issue
Block a user