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
a83fdc71
Commit
a83fdc71
authored
Jun 07, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document the aggregate_scores function
parent
4a0969df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
10 deletions
+18
-10
common/lib/xmodule/graders.py
+18
-10
No files found.
common/lib/xmodule/graders.py
View file @
a83fdc71
...
@@ -9,26 +9,34 @@ log = logging.getLogger("mitx.courseware")
...
@@ -9,26 +9,34 @@ log = logging.getLogger("mitx.courseware")
# Section either indicates the name of the problem or the name of the section
# Section either indicates the name of the problem or the name of the section
Score
=
namedtuple
(
"Score"
,
"earned possible graded section"
)
Score
=
namedtuple
(
"Score"
,
"earned possible graded section"
)
def
aggregate_scores
(
scores
,
section_name
=
"summary"
):
def
aggregate_scores
(
scores
,
section_name
=
"summary"
):
"""
scores: A list of Score objects
returns: A tuple (all_total, graded_total).
all_total: A Score representing the total score summed over all input scores
graded_total: A Score representing the score summed over all graded input scores
"""
total_correct_graded
=
sum
(
score
.
earned
for
score
in
scores
if
score
.
graded
)
total_correct_graded
=
sum
(
score
.
earned
for
score
in
scores
if
score
.
graded
)
total_possible_graded
=
sum
(
score
.
possible
for
score
in
scores
if
score
.
graded
)
total_possible_graded
=
sum
(
score
.
possible
for
score
in
scores
if
score
.
graded
)
total_correct
=
sum
(
score
.
earned
for
score
in
scores
)
total_correct
=
sum
(
score
.
earned
for
score
in
scores
)
total_possible
=
sum
(
score
.
possible
for
score
in
scores
)
total_possible
=
sum
(
score
.
possible
for
score
in
scores
)
#regardless of whether or not it is graded
#regardless of whether or not it is graded
all_total
=
Score
(
total_correct
,
all_total
=
Score
(
total_correct
,
total_possible
,
total_possible
,
False
,
False
,
section_name
)
section_name
)
#selecting only graded things
#selecting only graded things
graded_total
=
Score
(
total_correct_graded
,
graded_total
=
Score
(
total_correct_graded
,
total_possible_graded
,
total_possible_graded
,
True
,
True
,
section_name
)
section_name
)
return
all_total
,
graded_total
return
all_total
,
graded_total
def
grader_from_conf
(
conf
):
def
grader_from_conf
(
conf
):
"""
"""
This creates a CourseGrader from a configuration (such as in course_settings.py).
This creates a CourseGrader from a configuration (such as in course_settings.py).
...
...
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