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
e2dd118c
Commit
e2dd118c
authored
Aug 07, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added has_score attribute to xmodule, for problem-like xmodules.
parent
0cb100cf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
6 deletions
+10
-6
common/lib/xmodule/xmodule/capa_module.py
+1
-0
common/lib/xmodule/xmodule/course_module.py
+4
-4
common/lib/xmodule/xmodule/x_module.py
+3
-0
lms/djangoapps/courseware/grades.py
+2
-2
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
e2dd118c
...
...
@@ -564,6 +564,7 @@ class CapaDescriptor(RawDescriptor):
module_class
=
CapaModule
stores_state
=
True
has_score
=
True
# Capa modules have some additional metadata:
# TODO (vshnayder): do problems have any other metadata? Do they
...
...
common/lib/xmodule/xmodule/course_module.py
View file @
e2dd118c
...
...
@@ -99,10 +99,10 @@ class CourseDescriptor(SequenceDescriptor):
sections
=
[]
for
s
in
c
.
get_children
():
if
s
.
metadata
.
get
(
'graded'
,
False
):
# TODO: Only include modules that have a score here
xmoduledescriptors
=
[
child
for
child
in
yield_descriptor_descendents
(
s
)]
section_description
=
{
'section_descriptor'
:
s
,
'xmoduledescriptors'
:
xmoduledescriptors
}
xmoduledescriptors
=
list
(
yield_descriptor_descendents
(
s
))
# The xmoduledescriptors included here are only the ones that have scores.
section_description
=
{
'section_descriptor'
:
s
,
'xmoduledescriptors'
:
filter
(
lambda
child
:
child
.
has_score
,
xmoduledescriptors
)
}
section_format
=
s
.
metadata
.
get
(
'format'
,
""
)
graded_sections
[
section_format
]
=
graded_sections
.
get
(
section_format
,
[]
)
+
[
section_description
]
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
e2dd118c
...
...
@@ -308,6 +308,9 @@ class XModuleDescriptor(Plugin, HTMLSnippet):
# Attributes for inpsection of the descriptor
stores_state
=
False
# Indicates wether the xmodule state should be
# stored in a database (independent of shared state)
has_score
=
False
# This indicates whether the xmodule is a problem-type.
# It should respond to max_score() and grade(). It can be graded or ungraded
# (like a practice problem).
# A list of metadata that this module can inherit from its parent module
inheritable_metadata
=
(
...
...
lms/djangoapps/courseware/grades.py
View file @
e2dd118c
...
...
@@ -183,8 +183,8 @@ def get_score(user, problem, student_module_cache):
problem: an XModule
cache: A StudentModuleCache
"""
if
not
problem
.
descriptor
.
stores_state
:
# These are not problems, and do not
store stat
e
if
not
problem
.
descriptor
.
stores_state
or
not
problem
.
descriptor
.
has_score
:
# These are not problems, and do not
have a scor
e
return
(
None
,
None
)
correct
=
0.0
...
...
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