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
8a44c5e3
Commit
8a44c5e3
authored
Aug 07, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed weighting of individual problems. Unmodified problems have weight None, not 1.
parent
071b92e6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
common/lib/xmodule/xmodule/capa_module.py
+1
-1
lms/djangoapps/courseware/grades.py
+9
-5
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
8a44c5e3
...
@@ -130,7 +130,7 @@ class CapaModule(XModule):
...
@@ -130,7 +130,7 @@ class CapaModule(XModule):
if
weight_string
:
if
weight_string
:
self
.
weight
=
float
(
weight_string
)
self
.
weight
=
float
(
weight_string
)
else
:
else
:
self
.
weight
=
1
self
.
weight
=
None
if
self
.
rerandomize
==
'never'
:
if
self
.
rerandomize
==
'never'
:
seed
=
1
seed
=
1
...
...
lms/djangoapps/courseware/grades.py
View file @
8a44c5e3
...
@@ -9,7 +9,7 @@ from xmodule import graders
...
@@ -9,7 +9,7 @@ from xmodule import graders
from
xmodule.graders
import
Score
from
xmodule.graders
import
Score
from
models
import
StudentModule
from
models
import
StudentModule
_
log
=
logging
.
getLogger
(
"mitx.courseware"
)
log
=
logging
.
getLogger
(
"mitx.courseware"
)
def
yield_module_descendents
(
module
):
def
yield_module_descendents
(
module
):
for
child
in
module
.
get_display_items
():
for
child
in
module
.
get_display_items
():
...
@@ -83,12 +83,13 @@ def grade(student, request, course, student_module_cache=None):
...
@@ -83,12 +83,13 @@ def grade(student, request, course, student_module_cache=None):
section_total
,
graded_total
=
graders
.
aggregate_scores
(
scores
,
section_name
)
section_total
,
graded_total
=
graders
.
aggregate_scores
(
scores
,
section_name
)
else
:
else
:
section_total
=
Score
(
0.0
,
1.0
,
False
,
section_name
)
section_total
=
Score
(
0.0
,
1.0
,
False
,
section_name
)
graded_possible
=
1.0
#if s.metadata.get("graded", False) else 0.0
graded_total
=
Score
(
0.0
,
1.0
,
True
,
section_name
)
graded_total
=
Score
(
0.0
,
graded_possible
,
True
,
section_name
)
#Add the graded total to totaled_scores
#Add the graded total to totaled_scores
if
graded_total
.
possible
>
0
:
if
graded_total
.
possible
>
0
:
format_scores
.
append
(
graded_total
)
format_scores
.
append
(
graded_total
)
else
:
log
.
exception
(
"Unable to grade a section with a total possible score of zero. "
+
str
(
section_descriptor
.
id
))
totaled_scores
[
section_format
]
=
format_scores
totaled_scores
[
section_format
]
=
format_scores
...
@@ -207,8 +208,11 @@ def get_score(user, problem, student_module_cache):
...
@@ -207,8 +208,11 @@ def get_score(user, problem, student_module_cache):
if
correct
is
not
None
and
total
is
not
None
:
if
correct
is
not
None
and
total
is
not
None
:
#Now we re-weight the problem, if specified
#Now we re-weight the problem, if specified
weight
=
getattr
(
problem
,
'weight'
,
1
)
weight
=
getattr
(
problem
,
'weight'
,
None
)
if
weight
!=
1
:
if
weight
is
not
None
:
if
total
==
0
:
log
.
exception
(
"Cannot reweight a problem with zero weight. Problem: "
+
str
(
instance_module
))
return
(
correct
,
total
)
correct
=
correct
*
weight
/
total
correct
=
correct
*
weight
/
total
total
=
weight
total
=
weight
...
...
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