Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
f2abce53
Commit
f2abce53
authored
Feb 07, 2017
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
request-cache grades feature flag to avoid 400+ memcached hits
parent
744fea8a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletions
+5
-1
lms/djangoapps/grades/config/models.py
+2
-0
lms/djangoapps/grades/config/tests/utils.py
+3
-1
No files found.
lms/djangoapps/grades/config/models.py
View file @
f2abce53
...
@@ -6,6 +6,7 @@ from config_models.models import ConfigurationModel
...
@@ -6,6 +6,7 @@ from config_models.models import ConfigurationModel
from
django.conf
import
settings
from
django.conf
import
settings
from
django.db.models
import
BooleanField
from
django.db.models
import
BooleanField
from
openedx.core.djangoapps.xmodule_django.models
import
CourseKeyField
from
openedx.core.djangoapps.xmodule_django.models
import
CourseKeyField
from
request_cache.middleware
import
request_cached
class
PersistentGradesEnabledFlag
(
ConfigurationModel
):
class
PersistentGradesEnabledFlag
(
ConfigurationModel
):
...
@@ -19,6 +20,7 @@ class PersistentGradesEnabledFlag(ConfigurationModel):
...
@@ -19,6 +20,7 @@ class PersistentGradesEnabledFlag(ConfigurationModel):
enabled_for_all_courses
=
BooleanField
(
default
=
False
)
enabled_for_all_courses
=
BooleanField
(
default
=
False
)
@classmethod
@classmethod
@request_cached
def
feature_enabled
(
cls
,
course_id
=
None
):
def
feature_enabled
(
cls
,
course_id
=
None
):
"""
"""
Looks at the currently active configuration model to determine whether
Looks at the currently active configuration model to determine whether
...
...
lms/djangoapps/grades/config/tests/utils.py
View file @
f2abce53
...
@@ -2,8 +2,9 @@
...
@@ -2,8 +2,9 @@
Provides helper functions for tests that want
Provides helper functions for tests that want
to configure flags related to persistent grading.
to configure flags related to persistent grading.
"""
"""
from
lms.djangoapps.grades.config.models
import
PersistentGradesEnabledFlag
,
CoursePersistentGradesFlag
from
contextlib
import
contextmanager
from
contextlib
import
contextmanager
from
lms.djangoapps.grades.config.models
import
PersistentGradesEnabledFlag
,
CoursePersistentGradesFlag
from
request_cache.middleware
import
RequestCache
@contextmanager
@contextmanager
...
@@ -18,6 +19,7 @@ def persistent_grades_feature_flags(
...
@@ -18,6 +19,7 @@ def persistent_grades_feature_flags(
as they need to set the global setting and the course-specific
as they need to set the global setting and the course-specific
setting for a single course.
setting for a single course.
"""
"""
RequestCache
.
clear_request_cache
()
PersistentGradesEnabledFlag
.
objects
.
create
(
enabled
=
global_flag
,
enabled_for_all_courses
=
enabled_for_all_courses
)
PersistentGradesEnabledFlag
.
objects
.
create
(
enabled
=
global_flag
,
enabled_for_all_courses
=
enabled_for_all_courses
)
if
course_id
:
if
course_id
:
CoursePersistentGradesFlag
.
objects
.
create
(
course_id
=
course_id
,
enabled
=
enabled_for_course
)
CoursePersistentGradesFlag
.
objects
.
create
(
course_id
=
course_id
,
enabled
=
enabled_for_course
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment