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
3be5423b
Commit
3be5423b
authored
Mar 12, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small refactor on the grades. Also made the gradebook render a graph for each student
--HG-- branch : bridger-grades
parent
e2995a9e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
27 deletions
+52
-27
gradebook.html
+38
-15
profile.html
+3
-2
profile_graphs.js
+11
-10
No files found.
gradebook.html
View file @
3be5423b
<table>
% for s in students:
<h1><a
href=
/profile/${s['id']}
>
${s['username']}
</a></h1>
% for c in s['grade_info']['grade_summary']:
<h2>
${c['category']}
</h2>
<p>
% if 'subscores' in c:
% for ss in c['subscores']:
<br>
${ss['summary']}
% endfor
% endif
</p>
% endfor
% endfor
</table>
<
%
namespace
name=
"profile_graphs"
file=
"profile_graphs.js"
/>
<html>
<head>
<script
type=
"text/javascript"
src=
"${ settings.LIB_URL }jquery-1.6.2.min.js"
></script>
<script
type=
"text/javascript"
src=
"${ settings.LIB_URL }jquery-ui-1.8.16.custom.min.js"
></script>
<script
type=
"text/javascript"
src=
"/static/js/flot/jquery.flot.js"
></script>
<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>
% for s in students:
<script>
$
{
profile_graphs
.
body
(
s
[
'grade_info'
][
'grade_summary'
],
"grade-detail-graph-"
+
str
(
s
[
'id'
]))}
</script>
%endfor
</head>
<body>
% for s in students:
<h1><a
href=
/profile/${s['id']}
>
${s['username']}
</a></h1>
<div
id=
"grade-detail-graph-${s['id']}"
style=
"width:1000;height:300;"
></div>
<!---
% for c in s['grade_info']['grade_summary']:
<h2>${c['category']} </h2>
<p>
% if 'subscores' in c:
% for ss in c['subscores']:
<br>${ss['summary']}
% endfor
% endif
</p>
% endfor
-->
% endfor
</body>
</html>
profile.html
View file @
3be5423b
<
%
inherit
file=
"main.html"
/>
<
%
namespace
name=
"profile_graphs"
file=
"profile_graphs.js"
/>
<
%!
from
django
.
core
.
urlresolvers
import
reverse
...
...
@@ -9,7 +10,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>
<%
include
file
=
"profile_graphs.js"
/>
$
{
profile_graphs
.
body
(
grade_summary
,
"grade-detail-graph"
)}
</script>
<script>
...
...
@@ -93,7 +94,7 @@ $(function() {
<div
id=
"grade-detail-graph"
></div>
<ol
class=
"chapters"
>
%for chapter in c
hapters
:
%for chapter in c
ourseware_summary
:
%if not chapter['chapter'] == "hidden":
<li>
<h2><a
href=
"${reverse('courseware_chapter', args=format_url_params([chapter['course'], chapter['chapter']])) }"
>
...
...
profile_graphs.js
View file @
3be5423b
<%
page
args
=
"grade_summary, graph_div_id, **kwargs"
/>
<%!
import
json
%>
...
...
@@ -57,21 +58,21 @@ $(function () {
category_total_label = section['
category
'] + " Total"
series.append({
'
label
' : category_total_label,
'
data
' : [ [tickIndex, section['
totalscore
']
['
score
']
] ],
'
data
' : [ [tickIndex, section['
totalscore
']] ],
'
color
' : colors[sectionIndex]
})
ticks.append( [tickIndex, section['
totallabel
']] )
detail_tooltips[category_total_label] = [section['
totalscore
']['
summary
']]
detail_tooltips[category_total_label] = [section['
totalscore
_
summary
']]
else:
series.append({
'
label
' : section['
category
'],
'
data
' : [ [tickIndex, section['
totalscore
']
['
score
']
] ],
'
data
' : [ [tickIndex, section['
totalscore
']] ],
'
color
' : colors[sectionIndex]
})
ticks.append( [tickIndex, section['
totallabel
']] )
detail_tooltips[section['
category
']] = [section['
totalscore
']['
summary
']]
detail_tooltips[section['
category
']] = [section['
totalscore
_
summary
']]
tickIndex += 1 + sectionSpacer
sectionIndex += 1
...
...
@@ -86,12 +87,12 @@ $(function () {
overviewBarX = tickIndex
for section in grade_summary:
weighted_score = section['
totalscore
']
['
score
']
* section['
weight
']
weighted_score = section['
totalscore
'] * section['
weight
']
summary_text = "{0} - {1:.1%} of a possible {2:.0%}".format(section['
category
'], weighted_score, section['
weight
'])
weighted_category_label = section['
category
'] + " - Weighted"
if section['
totalscore
']
['
score
']
> 0:
if section['
totalscore
'] > 0:
series.append({
'
label
' : weighted_category_label,
'
data
' : [ [overviewBarX, weighted_score] ],
...
...
@@ -101,7 +102,7 @@ $(function () {
detail_tooltips[weighted_category_label] = [ summary_text ]
sectionIndex += 1
totalWeight += section['
weight
']
totalScore += section['
totalscore
']
['
score
']
* section['
weight
']
totalScore += section['
totalscore
'] * section['
weight
']
ticks += [ [overviewBarX, "Total"] ]
tickIndex += 1 + sectionSpacer
...
...
@@ -128,7 +129,7 @@ $(function () {
legend
:
{
show
:
false
},
};
var
$grade_detail_graph
=
$
(
"#
grade-detail-graph
"
);
var
$grade_detail_graph
=
$
(
"#
${graph_div_id}
"
);
if
(
$grade_detail_graph
.
length
>
0
)
{
var
plot
=
$
.
plot
(
$grade_detail_graph
,
series
,
options
);
...
...
@@ -137,7 +138,7 @@ $(function () {
}
var
previousPoint
=
null
;
$
(
"#grade-detail-graph"
)
.
bind
(
"plothover"
,
function
(
event
,
pos
,
item
)
{
$
grade_detail_graph
.
bind
(
"plothover"
,
function
(
event
,
pos
,
item
)
{
$
(
"#x"
).
text
(
pos
.
x
.
toFixed
(
2
));
$
(
"#y"
).
text
(
pos
.
y
.
toFixed
(
2
));
if
(
item
)
{
...
...
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