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
04221210
Commit
04221210
authored
Apr 06, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Weighted section grading is mostly working, but the final grade isn't on the graph yet.
parent
b0e2ea3a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
10 deletions
+42
-10
djangoapps/courseware/grades.py
+35
-1
templates/profile_graphs.js
+7
-9
No files found.
djangoapps/courseware/grades.py
View file @
04221210
...
...
@@ -119,7 +119,36 @@ class FormatWithDropsGrader(CourseGrader):
'section_breakdown'
:
breakdown
,
#No grade_breakdown here
}
class
WeightedSubsectionsGrader
(
CourseGrader
):
"""
This grader takes a list of tuples containing (grader, section_name, weight) and computes
a final grade by totalling the contribution of each sub grader and weighting it
accordingly. For example, the sections may be
[ (homeworkGrader, "Homework", 0.15), (labGrader, "Labs", 0.15), (midtermGrader, "Midterm", 0.30), (finalGrader, "Final", 0.40) ]
"""
def
__init__
(
self
,
sections
):
self
.
sections
=
sections
def
grade
(
self
,
grade_sheet
):
total_percent
=
0.0
section_breakdown
=
[]
grade_breakdown
=
[]
for
subgrader
,
section_name
,
weight
in
self
.
sections
:
subgrade_result
=
subgrader
.
grade
(
grade_sheet
)
weightedPercent
=
subgrade_result
[
'percent'
]
*
weight
section_detail
=
"{0} = {1:.1
%
} of a possible {2:.0
%
}"
.
format
(
section_name
,
weightedPercent
,
weight
)
section_category
=
"{0} - Weighted"
.
format
(
section_name
)
total_percent
+=
weightedPercent
section_breakdown
+=
subgrade_result
[
'section_breakdown'
]
grade_breakdown
.
append
(
{
'percent'
:
weightedPercent
,
'detail'
:
section_detail
,
'category'
:
section_category
}
)
return
{
'percent'
:
total_percent
,
'section_breakdown'
:
section_breakdown
,
'grade_breakdown'
:
grade_breakdown
}
def
get_score
(
user
,
problem
,
cache
):
...
...
@@ -245,8 +274,13 @@ def grade_sheet(student):
'sections'
:
sections
,})
g
rader
=
FormatWithDropsGrader
(
"Homework"
,
12
,
2
,
"Homework"
,
"Homework {index} - {name} - {percent:.0
%
} ({earned:g}/{possible:g})"
,
hwG
rader
=
FormatWithDropsGrader
(
"Homework"
,
12
,
2
,
"Homework"
,
"Homework {index} - {name} - {percent:.0
%
} ({earned:g}/{possible:g})"
,
"Unreleased Homework {index} - 0
%
(?/?)"
,
"HW {index:02d}"
,
"Homework Average = {percent:.0
%
}"
,
"HW Avg"
)
labGrader
=
FormatWithDropsGrader
(
"Lab"
,
12
,
2
,
"Labs"
,
"Lab {index} - {name} - {percent:.0
%
} ({earned:g}/{possible:g})"
,
"Unreleased Lab {index} - 0
%
(?/?)"
,
"Lab {index:02d}"
,
"Lab Average = {percent:.0
%
}"
,
"Lab Avg"
)
grader
=
WeightedSubsectionsGrader
(
[(
hwGrader
,
"Homework"
,
0.15
),
(
labGrader
,
"Labs"
,
0.15
)]
)
grade_summary
=
grader
.
grade
(
totaled_scores
)
...
...
templates/profile_graphs.js
View file @
04221210
...
...
@@ -19,20 +19,19 @@ $(function () {
}
/* -------------------------------- Grade detail bars -------------------------------- */
<%
colors
=
[
"#b72121"
,
"#600101"
,
"#666666"
,
"#333333"
]
categories
=
{}
#
'
tickIndex
=
1
sectionSpacer
=
0.5
sectionIndex
=
0
series = []
ticks
=
[]
#
These
are
the
indices
and
x
-
axis
labels
for
the
data
bottomTicks
=
[]
#
Labels
on
the
bottom
detail_tooltips
=
{}
#
This
an
dictionary
mapping
from
'section'
->
array
of
detail_tooltips
droppedScores = [] #These are the datapoints to indicate assignments which are
n'
t
factored
into
the
total
score
droppedScores
=
[]
#
These
are
the
datapoints
to
indicate
assignments
which
are
no
t
factored
into
the
total
score
dropped_score_tooltips
=
[]
for
section
in
grade_summary
[
'section_breakdown'
]:
...
...
@@ -44,7 +43,7 @@ $(function () {
categories
[
section
[
'category'
]
]
=
{
'label'
:
section
[
'category'
],
'data'
:
[],
'color'
:
colors
[
colorIndex
]}
categoryData
=
categories
[
section
[
'category'
]
]
categoryData
[
'data'
].
append
(
[
tickIndex
,
section
[
'percent'
]]
)
...
...
@@ -60,9 +59,10 @@ $(function () {
if
section
.
get
(
'prominent'
,
False
):
tickIndex
+=
sectionSpacer
%>
var
series
=
$
{
json
.
dumps
(
series
)
};
var
series
=
$
{
json
.
dumps
(
categories
.
values
()
)
};
var
ticks
=
$
{
json
.
dumps
(
ticks
)
};
var
bottomTicks
=
$
{
json
.
dumps
(
bottomTicks
)
};
var
detail_tooltips
=
$
{
json
.
dumps
(
detail_tooltips
)
};
...
...
@@ -86,9 +86,7 @@ $(function () {
var
$grade_detail_graph
=
$
(
"#${graph_div_id}"
);
if
(
$grade_detail_graph
.
length
>
0
)
{
var
plot
=
$
.
plot
(
$grade_detail_graph
,
series
,
options
);
var
o
=
plot
.
pointOffset
({
x
:
$
{
overviewBarX
}
,
y
:
$
{
totalScore
}});
$grade_detail_graph
.
append
(
'<div style="position:absolute;left:'
+
(
o
.
left
-
12
)
+
'px;top:'
+
(
o
.
top
-
20
)
+
'px">${"{totalscore:.0%}".format(totalscore=totalScore)}</div>'
);
//We need to put back the plotting of the percent here
}
var
previousPoint
=
null
;
...
...
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