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
1837c4c0
Commit
1837c4c0
authored
May 15, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the profile graph and gradebook to use the GRADE_CUTOFFS from the course settings.
parent
f2ae8591
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
28 deletions
+47
-28
djangoapps/courseware/grades.py
+11
-5
djangoapps/courseware/views.py
+7
-3
templates/gradebook.html
+15
-15
templates/profile.html
+1
-1
templates/profile_graphs.js
+13
-4
No files found.
djangoapps/courseware/grades.py
View file @
1837c4c0
...
...
@@ -87,17 +87,23 @@ def grade_sheet(student):
grader
=
course_settings
.
GRADER
grade_summary
=
grader
.
grade
(
totaled_scores
)
letter_grade
=
None
for
possible_grade
in
[
'A'
,
'B'
,
'C'
]:
if
grade_summary
[
'percent'
]
>=
course_settings
.
GRADE_CUTOFFS
[
possible_grade
]:
letter_grade
=
possible_grade
break
letter_grade
=
grade_for_percentage
(
grade_summary
[
'percent'
])
_log
.
debug
(
"Final grade: "
+
str
(
letter_grade
))
return
{
'courseware_summary'
:
chapters
,
'grade_summary'
:
grade_summary
,
'grade'
:
letter_grade
}
def
grade_for_percentage
(
percentage
):
letter_grade
=
None
for
possible_grade
in
[
'A'
,
'B'
,
'C'
]:
if
percentage
>=
course_settings
.
GRADE_CUTOFFS
[
possible_grade
]:
letter_grade
=
possible_grade
break
return
letter_grade
def
aggregate_scores
(
scores
,
section_name
=
"summary"
):
total_correct_graded
=
sum
(
score
.
earned
for
score
in
scores
if
score
.
graded
)
...
...
djangoapps/courseware/views.py
View file @
1837c4c0
...
...
@@ -45,10 +45,13 @@ def gradebook(request):
'id'
:
s
.
id
,
'email'
:
s
.
email
,
'grade_info'
:
grades
.
grade_sheet
(
s
),
'realname'
:
UserProfile
.
objects
.
get
(
user
=
s
)
.
name
'realname'
:
UserProfile
.
objects
.
get
(
user
=
s
)
.
name
,
}
for
s
in
student_objects
]
return
render_to_response
(
'gradebook.html'
,{
'students'
:
student_info
})
return
render_to_response
(
'gradebook.html'
,
{
'students'
:
student_info
,
'grade_cutoffs'
:
course_settings
.
GRADE_CUTOFFS
,}
)
@cache_control
(
no_cache
=
True
,
no_store
=
True
,
must_revalidate
=
True
)
def
profile
(
request
,
student_id
=
None
):
...
...
@@ -73,7 +76,8 @@ def profile(request, student_id = None):
'language'
:
user_info
.
language
,
'email'
:
student
.
email
,
'format_url_params'
:
content_parser
.
format_url_params
,
'csrf'
:
csrf
(
request
)[
'csrf_token'
]
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'grade_cutoffs'
:
course_settings
.
GRADE_CUTOFFS
,
}
context
.
update
(
grades
.
grade_sheet
(
student
))
...
...
templates/gradebook.html
View file @
1837c4c0
...
...
@@ -6,11 +6,11 @@
<script
type=
"text/javascript"
src=
"/static/js/flot/jquery.flot.symbol.js"
></script>
<style
type=
"text/css"
>
.grade_
a
{
color
:
green
;}
.grade_
b
{
color
:
Chocolate
;}
.grade_
c
{
color
:
DarkSlateGray
;}
.grade_
f
{
color
:
DimGray
;}
.grade_
n
one
{
color
:
LightGray
;}
.grade_
A
{
color
:
green
;}
.grade_
B
{
color
:
Chocolate
;}
.grade_
C
{
color
:
DarkSlateGray
;}
.grade_
F
{
color
:
DimGray
;}
.grade_
N
one
{
color
:
LightGray
;}
</style>
</
%
block>
...
...
@@ -38,15 +38,15 @@
<
%
def
name=
"percent_data(percentage)"
>
<
%
data_class =
"grade_none"
if
percentage
>
.87
:
data_class = "grade_a"
elif percentage > .70
:
data_class = "grade_b"
elif percentage > .6:
data_class = "grade_c"
elif percentage > 0:
data_class = "grade_f"
letter_grade =
'None'
if
percentage
>
0
:
letter_grade = 'F'
for grade in ['A', 'B', 'C']
:
if percentage >= grade_cutoffs[grade]:
letter_grade = grade
break
data_class = "grade_" + letter_grade
%>
<td
class=
"${data_class}"
>
${ "{0:.0%}".format( percentage ) }
</td>
</
%
def>
...
...
@@ -55,7 +55,7 @@
<tr>
<td><a
href=
"/profile/${student['id']}/"
>
${student['username']}
</a></td>
%for section in student['grade_info']['grade_summary']['section_breakdown']:
${percent_data( section['percent']
)}
${percent_data( section['percent'])}
%endfor
<th>
${percent_data( student['grade_info']['grade_summary']['percent'])}
</th>
</tr>
...
...
templates/profile.html
View file @
1837c4c0
...
...
@@ -12,7 +12,7 @@
<script
type=
"text/javascript"
src=
"/static/js/flot/jquery.flot.stack.js"
></script>
<script
type=
"text/javascript"
src=
"/static/js/flot/jquery.flot.symbol.js"
></script>
<script>
$
{
profile_graphs
.
body
(
grade_summary
,
"grade-detail-graph"
)}
$
{
profile_graphs
.
body
(
grade_summary
,
grade_cutoffs
,
"grade-detail-graph"
)}
</script>
<script>
...
...
templates/profile_graphs.js
View file @
1837c4c0
<%
page
args
=
"grade_summary, graph_div_id, **kwargs"
/>
<%
page
args
=
"grade_summary, gra
de_cutoffs, gra
ph_div_id, **kwargs"
/>
<%!
import
json
%>
...
...
@@ -91,6 +91,14 @@ $(function () {
totalScore
=
grade_summary
[
'percent'
]
detail_tooltips
[
'Dropped Scores'
]
=
dropped_score_tooltips
##
-----------------------------
Grade
cutoffs
-------------------------
##
grade_cutoff_ticks
=
[
[
1
,
"100%"
],
[
0
,
"0%"
]
]
for
grade
in
[
'A'
,
'B'
,
'C'
]:
percent
=
grade_cutoffs
[
grade
]
grade_cutoff_ticks
.
append
(
[
percent
,
"{0} {1:.0%}"
.
format
(
grade
,
percent
)
]
)
%>
var
series
=
$
{
json
.
dumps
(
series
)
};
...
...
@@ -98,6 +106,7 @@ $(function () {
var
bottomTicks
=
$
{
json
.
dumps
(
bottomTicks
)
};
var
detail_tooltips
=
$
{
json
.
dumps
(
detail_tooltips
)
};
var
droppedScores
=
$
{
json
.
dumps
(
droppedScores
)
};
var
grade_cutoff_ticks
=
$
{
json
.
dumps
(
grade_cutoff_ticks
)
}
//Alwasy be sure that one series has the xaxis set to 2, or the second xaxis labels won't show up
series
.
push
(
{
label
:
'Dropped Scores'
,
data
:
droppedScores
,
points
:
{
symbol
:
"cross"
,
show
:
true
,
radius
:
3
},
bars
:
{
show
:
false
},
color
:
"#333"
}
);
...
...
@@ -107,10 +116,10 @@ $(function () {
lines
:
{
show
:
false
,
steps
:
false
},
bars
:
{
show
:
true
,
barWidth
:
0.8
,
align
:
'center'
,
lineWidth
:
0
,
fill
:
.
8
},},
xaxis
:
{
tickLength
:
0
,
min
:
0.0
,
max
:
$
{
tickIndex
-
sectionSpacer
},
ticks
:
ticks
,
labelAngle
:
90
},
yaxis
:
{
ticks
:
[[
1
,
"100%"
],
[
0.87
,
"A 87%"
],
[
0.7
,
"B 70%"
],
[
0.6
,
"C 60%"
],
[
0
,
"0%"
]]
,
min
:
0.0
,
max
:
1.0
,
labelWidth
:
50
},
yaxis
:
{
ticks
:
grade_cutoff_ticks
,
min
:
0.0
,
max
:
1.0
,
labelWidth
:
50
},
grid
:
{
hoverable
:
true
,
clickable
:
true
,
borderWidth
:
1
,
markings
:
[
{
yaxis
:
{
from
:
0.87
,
to
:
1
},
color
:
"#ddd"
},
{
yaxis
:
{
from
:
0.7
,
to
:
0.87
},
color
:
"#e9e9e9"
},
{
yaxis
:
{
from
:
0.6
,
to
:
0.7
},
color
:
"#f3f3f3"
},
]
},
markings
:
[
{
yaxis
:
{
from
:
$
{
grade_cutoffs
[
'A'
]},
to
:
1
},
color
:
"#ddd"
},
{
yaxis
:
{
from
:
$
{
grade_cutoffs
[
'B'
]},
to
:
$
{
grade_cutoffs
[
'A'
]}
},
color
:
"#e9e9e9"
},
{
yaxis
:
{
from
:
$
{
grade_cutoffs
[
'C'
]},
to
:
$
{
grade_cutoffs
[
'B'
]}
},
color
:
"#f3f3f3"
},
]
},
legend
:
{
show
:
false
},
};
...
...
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