Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
9a184f06
Commit
9a184f06
authored
Mar 21, 2014
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add comments, fix typo.
parent
26993248
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletions
+17
-1
apps/openassessment/assessment/models.py
+1
-1
apps/openassessment/assessment/serializers.py
+16
-0
No files found.
apps/openassessment/assessment/models.py
View file @
9a184f06
...
@@ -106,7 +106,7 @@ class Rubric(models.Model):
...
@@ -106,7 +106,7 @@ class Rubric(models.Model):
InvalidOptionSelection: the selected options do not match the rubric.
InvalidOptionSelection: the selected options do not match the rubric.
"""
"""
# Cache based on the content_hash, not the id. It's sligh
lt
y safer, and
# Cache based on the content_hash, not the id. It's sligh
tl
y safer, and
# we don't have to worry about invalidation of the cache while running
# we don't have to worry about invalidation of the cache while running
# tests.
# tests.
rubric_criteria_dict_cache_key
=
(
rubric_criteria_dict_cache_key
=
(
...
...
apps/openassessment/assessment/serializers.py
View file @
9a184f06
...
@@ -105,6 +105,22 @@ class RubricSerializer(NestedModelSerializer):
...
@@ -105,6 +105,22 @@ class RubricSerializer(NestedModelSerializer):
@classmethod
@classmethod
def
serialized_from_cache
(
cls
,
rubric
,
local_cache
=
None
):
def
serialized_from_cache
(
cls
,
rubric
,
local_cache
=
None
):
"""For a given `Rubric` model object, return a serialized version.
This method will attempt to use the cache if possible, first looking at
the `local_cache` dict you can pass in, and then looking at whatever
Django cache is configured.
Args:
rubric (Rubric): The Rubric model to get the serialized form of.
local_cach (dict): Mapping of `rubric.content_hash` to serialized
rubric dictionary. We include this so that we can call this
method in a loop.
Returns:
dict: `Rubric` fields as a dictionary, with `criteria` and `options`
relations followed.
"""
# Optional local cache you can send in (for when you're calling this
# Optional local cache you can send in (for when you're calling this
# in a loop).
# in a loop).
local_cache
=
local_cache
or
{}
local_cache
=
local_cache
or
{}
...
...
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