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
7353d40b
Commit
7353d40b
authored
Apr 08, 2015
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Push field_object iteration inside _retrieve_fields, and rename to _cache_fields
parent
90597276
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
lms/djangoapps/courseware/model_data.py
+10
-8
No files found.
lms/djangoapps/courseware/model_data.py
View file @
7353d40b
...
...
@@ -164,8 +164,7 @@ class FieldDataCache(object):
"""
if
self
.
user
.
is_authenticated
():
for
scope
,
fields
in
self
.
_fields_to_cache
(
descriptors
)
.
items
():
for
field_object
in
self
.
_retrieve_fields
(
scope
,
fields
,
descriptors
):
self
.
cache
[
self
.
_cache_key_from_field_object
(
scope
,
field_object
)]
=
field_object
self
.
_cache_fields
(
scope
,
fields
,
descriptors
)
def
add_descriptor_descendents
(
self
,
descriptor
,
depth
=
None
,
descriptor_filter
=
lambda
descriptor
:
True
):
"""
...
...
@@ -253,7 +252,7 @@ class FieldDataCache(object):
return
block_types
def
_
retriev
e_fields
(
self
,
scope
,
fields
,
descriptors
):
def
_
cach
e_fields
(
self
,
scope
,
fields
,
descriptors
):
"""
Queries the database for all of the fields in the specified scope
"""
...
...
@@ -264,14 +263,14 @@ class FieldDataCache(object):
self
.
_all_usage_ids
(
descriptors
),
self
.
select_for_update
,
)
return
self
.
user_state_cache
.
_data
field_objects
=
self
.
user_state_cache
.
_data
elif
scope
==
Scope
.
user_state_summary
:
self
.
user_state_summary_cache
=
UserStateSummaryCache
(
self
.
_all_usage_ids
(
descriptors
),
fields
,
self
.
select_for_update
,
)
return
self
.
user_state_summary_cache
.
_data
field_objects
=
self
.
user_state_summary_cache
.
_data
elif
scope
==
Scope
.
preferences
:
self
.
preferences_cache
=
PreferencesCache
(
self
.
user
,
...
...
@@ -279,16 +278,19 @@ class FieldDataCache(object):
fields
,
self
.
select_for_update
,
)
return
self
.
preferences_cache
.
_data
field_objects
=
self
.
preferences_cache
.
_data
elif
scope
==
Scope
.
user_info
:
self
.
user_info_cache
=
UserInfoCache
(
self
.
user
,
fields
,
self
.
select_for_update
,
)
return
self
.
user_info_cache
.
_data
field_objects
=
self
.
user_info_cache
.
_data
else
:
return
[]
field_objects
=
[]
for
field_object
in
field_objects
:
self
.
cache
[
self
.
_cache_key_from_field_object
(
scope
,
field_object
)]
=
field_object
def
_fields_to_cache
(
self
,
descriptors
):
"""
...
...
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