Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
31ec5621
Commit
31ec5621
authored
8 years ago
by
Nimisha Asthagiri
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #14490 from edx/beryl/request-cache-feature-flag
request-cache grades feature flag to avoid 400+ memcached hits
parents
2026a518
f2abce53
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/grades/config/models.py
+2
-0
2 additions, 0 deletions
lms/djangoapps/grades/config/models.py
lms/djangoapps/grades/config/tests/utils.py
+3
-1
3 additions, 1 deletion
lms/djangoapps/grades/config/tests/utils.py
with
5 additions
and
1 deletion
lms/djangoapps/grades/config/models.py
+
2
−
0
View file @
31ec5621
...
...
@@ -6,6 +6,7 @@ from config_models.models import ConfigurationModel
from
django.conf
import
settings
from
django.db.models
import
BooleanField
from
openedx.core.djangoapps.xmodule_django.models
import
CourseKeyField
from
request_cache.middleware
import
request_cached
class
PersistentGradesEnabledFlag
(
ConfigurationModel
):
...
...
@@ -19,6 +20,7 @@ class PersistentGradesEnabledFlag(ConfigurationModel):
enabled_for_all_courses
=
BooleanField
(
default
=
False
)
@classmethod
@request_cached
def
feature_enabled
(
cls
,
course_id
=
None
):
"""
Looks at the currently active configuration model to determine whether
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/grades/config/tests/utils.py
+
3
−
1
View file @
31ec5621
...
...
@@ -2,8 +2,9 @@
Provides helper functions for tests that want
to configure flags related to persistent grading.
"""
from
lms.djangoapps.grades.config.models
import
PersistentGradesEnabledFlag
,
CoursePersistentGradesFlag
from
contextlib
import
contextmanager
from
lms.djangoapps.grades.config.models
import
PersistentGradesEnabledFlag
,
CoursePersistentGradesFlag
from
request_cache.middleware
import
RequestCache
@contextmanager
...
...
@@ -18,6 +19,7 @@ def persistent_grades_feature_flags(
as they need to set the global setting and the course-specific
setting for a single course.
"""
RequestCache
.
clear_request_cache
()
PersistentGradesEnabledFlag
.
objects
.
create
(
enabled
=
global_flag
,
enabled_for_all_courses
=
enabled_for_all_courses
)
if
course_id
:
CoursePersistentGradesFlag
.
objects
.
create
(
course_id
=
course_id
,
enabled
=
enabled_for_course
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment