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
c00721bb
Commit
c00721bb
authored
Jun 18, 2013
by
Felix Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the preferences scope of xblock.
Added self to authors. Conflicts: AUTHORS CHANGELOG.rst
parent
501830c9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
3 deletions
+11
-3
AUTHORS
+1
-0
CHANGELOG.rst
+2
-0
lms/djangoapps/courseware/model_data.py
+1
-1
lms/djangoapps/courseware/tests/factories.py
+1
-1
lms/djangoapps/courseware/tests/test_model_data.py
+6
-1
No files found.
AUTHORS
View file @
c00721bb
...
...
@@ -77,3 +77,4 @@ Slater Victoroff <slater.r.victoroff@gmail.com>
Peter Fogg <peter.p.fogg@gmail.com>
Bethany LaPenta <lapentab@mit.edu>
Renzo Lucioni <renzolucioni@gmail.com>
Felix Sun <felixsun@mit.edu>
CHANGELOG.rst
View file @
c00721bb
...
...
@@ -27,6 +27,8 @@ students' number of attempts to zero. Provides a list of background
tasks that are currently running for the course, and an option to
see a history of background tasks for a given problem.
LMS: Fixed the preferences scope for storing data in xmodules.
LMS: Forums. Added handling for case where discussion module can get `None` as
value of lms.start in `lms/djangoapps/django_comment_client/utils.py`
...
...
lms/djangoapps/courseware/model_data.py
View file @
c00721bb
...
...
@@ -163,7 +163,7 @@ class ModelDataCache(object):
return
self
.
_chunked_query
(
XModuleStudentPrefsField
,
'module_type__in'
,
set
(
descriptor
.
location
.
category
for
descriptor
in
self
.
descriptors
),
set
(
descriptor
.
module_class
.
__name__
for
descriptor
in
self
.
descriptors
),
student
=
self
.
user
.
pk
,
field_name__in
=
set
(
field
.
name
for
field
in
fields
),
)
...
...
lms/djangoapps/courseware/tests/factories.py
View file @
c00721bb
...
...
@@ -75,7 +75,7 @@ class StudentPrefsFactory(DjangoModelFactory):
field_name
=
'existing_field'
value
=
json
.
dumps
(
'old_value'
)
student
=
SubFactory
(
UserFactory
)
module_type
=
'
problem
'
module_type
=
'
MockProblemModule
'
class
StudentInfoFactory
(
DjangoModelFactory
):
...
...
lms/djangoapps/courseware/tests/test_model_data.py
View file @
c00721bb
...
...
@@ -29,6 +29,7 @@ def mock_descriptor(fields=[], lms_fields=[]):
descriptor
.
location
=
location
(
'def_id'
)
descriptor
.
module_class
.
fields
=
fields
descriptor
.
module_class
.
lms
.
fields
=
lms_fields
descriptor
.
module_class
.
__name__
=
'MockProblemModule'
return
descriptor
location
=
partial
(
Location
,
'i4x'
,
'edX'
,
'test_course'
,
'problem'
)
...
...
@@ -37,7 +38,7 @@ course_id = 'edX/test_course/test'
content_key
=
partial
(
LmsKeyValueStore
.
Key
,
Scope
.
content
,
None
,
location
(
'def_id'
))
settings_key
=
partial
(
LmsKeyValueStore
.
Key
,
Scope
.
settings
,
None
,
location
(
'def_id'
))
user_state_key
=
partial
(
LmsKeyValueStore
.
Key
,
Scope
.
user_state
,
'user'
,
location
(
'def_id'
))
prefs_key
=
partial
(
LmsKeyValueStore
.
Key
,
Scope
.
preferences
,
'user'
,
'
problem
'
)
prefs_key
=
partial
(
LmsKeyValueStore
.
Key
,
Scope
.
preferences
,
'user'
,
'
MockProblemModule
'
)
user_info_key
=
partial
(
LmsKeyValueStore
.
Key
,
Scope
.
user_info
,
'user'
,
None
)
...
...
@@ -190,6 +191,10 @@ class StorageTestBase(object):
self
.
mdc
=
ModelDataCache
([
mock_descriptor
([
mock_field
(
self
.
scope
,
'existing_field'
)])],
course_id
,
self
.
user
)
self
.
kvs
=
LmsKeyValueStore
(
self
.
desc_md
,
self
.
mdc
)
def
test_set_and_get_existing_field
(
self
):
self
.
kvs
.
set
(
self
.
key_factory
(
'existing_field'
),
'test_value'
)
self
.
assertEquals
(
'test_value'
,
self
.
kvs
.
get
(
self
.
key_factory
(
'existing_field'
)))
def
test_get_existing_field
(
self
):
"Test that getting an existing field in an existing Storage Field works"
self
.
assertEquals
(
'old_value'
,
self
.
kvs
.
get
(
self
.
key_factory
(
'existing_field'
)))
...
...
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