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
3e8631c2
Commit
3e8631c2
authored
May 01, 2015
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the use of StudentModules explicit in variable names in user_state_client.py
parent
13dc390f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
lms/djangoapps/courseware/user_state_client.py
+10
-10
No files found.
lms/djangoapps/courseware/user_state_client.py
View file @
3e8631c2
...
...
@@ -136,7 +136,7 @@ class DjangoXBlockUserStateClient(XBlockUserStateClient):
}
@contract
(
username
=
"basestring"
,
block_keys
=
"seq(UsageKey)|set(UsageKey)"
)
def
_get_
field_object
s
(
self
,
username
,
block_keys
):
def
_get_
student_module
s
(
self
,
username
,
block_keys
):
"""
Retrieve the :class:`~StudentModule`s for the supplied ``username`` and ``block_keys``.
...
...
@@ -186,7 +186,7 @@ class DjangoXBlockUserStateClient(XBlockUserStateClient):
if
scope
!=
Scope
.
user_state
:
raise
ValueError
(
"Only Scope.user_state is supported, not {}"
.
format
(
scope
))
modules
=
self
.
_get_
field_object
s
(
username
,
block_keys
)
modules
=
self
.
_get_
student_module
s
(
username
,
block_keys
)
for
module
,
usage_key
in
modules
:
if
module
.
state
is
None
:
state
=
{}
...
...
@@ -256,12 +256,12 @@ class DjangoXBlockUserStateClient(XBlockUserStateClient):
if
scope
!=
Scope
.
user_state
:
raise
ValueError
(
"Only Scope.user_state is supported"
)
student_modules
=
self
.
_get_
field_object
s
(
username
,
block_keys
)
student_modules
=
self
.
_get_
student_module
s
(
username
,
block_keys
)
for
student_module
,
_
in
student_modules
:
if
fields
is
None
:
field_object
.
state
=
"{}"
student_module
.
state
=
"{}"
else
:
current_state
=
json
.
loads
(
field_object
.
state
)
current_state
=
json
.
loads
(
student_module
.
state
)
for
field
in
fields
:
if
field
in
current_state
:
del
current_state
[
field
]
...
...
@@ -295,13 +295,13 @@ class DjangoXBlockUserStateClient(XBlockUserStateClient):
if
scope
!=
Scope
.
user_state
:
raise
ValueError
(
"Only Scope.user_state is supported"
)
field_objects
=
self
.
_get_field_object
s
(
username
,
block_keys
)
for
field_object
,
usage_key
in
field_object
s
:
if
field_object
.
state
is
None
:
student_modules
=
self
.
_get_student_module
s
(
username
,
block_keys
)
for
student_module
,
usage_key
in
student_module
s
:
if
student_module
.
state
is
None
:
continue
for
field
in
json
.
loads
(
field_object
.
state
):
yield
(
usage_key
,
field
,
field_object
.
modified
)
for
field
in
json
.
loads
(
student_module
.
state
):
yield
(
usage_key
,
field
,
student_module
.
modified
)
def
get_history
(
self
,
username
,
block_key
,
scope
=
Scope
.
user_state
):
"""We don't guarantee that history for many blocks will be fast."""
...
...
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