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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
23 deletions
+48
-23
gradebook.html
+35
-12
profile.html
+3
-2
profile_graphs.js
+10
-9
No files found.
gradebook.html
View file @
3be5423b
<table>
<
%
namespace
name=
"profile_graphs"
file=
"profile_graphs.js"
/>
% for s in students:
<h1><a
href=
/profile/${s['id']}
>
${s['username']}
</a></h1>
<html>
% for c in s['grade_info']['grade_summary']:
<head>
<h2>
${c['category']}
</h2>
<script
type=
"text/javascript"
src=
"${ settings.LIB_URL }jquery-1.6.2.min.js"
></script>
<p>
<script
type=
"text/javascript"
src=
"${ settings.LIB_URL }jquery-ui-1.8.16.custom.min.js"
></script>
% if 'subscores' in c:
<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']:
% for ss in c['subscores']:
<br>${ss['summary']}
<br>${ss['summary']}
% endfor
% endfor
% endif
% endif
</p>
</p>
% endfor
% endfor
% endfor
-->
</table>
% endfor
</body>
</html>
profile.html
View file @
3be5423b
<
%
inherit
file=
"main.html"
/>
<
%
inherit
file=
"main.html"
/>
<
%
namespace
name=
"profile_graphs"
file=
"profile_graphs.js"
/>
<
%!
<
%!
from
django
.
core
.
urlresolvers
import
reverse
from
django
.
core
.
urlresolvers
import
reverse
...
@@ -9,7 +10,7 @@
...
@@ -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.stack.js"
></script>
<script
type=
"text/javascript"
src=
"/static/js/flot/jquery.flot.symbol.js"
></script>
<script
type=
"text/javascript"
src=
"/static/js/flot/jquery.flot.symbol.js"
></script>
<script>
<script>
<%
include
file
=
"profile_graphs.js"
/>
$
{
profile_graphs
.
body
(
grade_summary
,
"grade-detail-graph"
)}
</script>
</script>
<script>
<script>
...
@@ -93,7 +94,7 @@ $(function() {
...
@@ -93,7 +94,7 @@ $(function() {
<div
id=
"grade-detail-graph"
></div>
<div
id=
"grade-detail-graph"
></div>
<ol
class=
"chapters"
>
<ol
class=
"chapters"
>
%for chapter in c
hapters
:
%for chapter in c
ourseware_summary
:
%if not chapter['chapter'] == "hidden":
%if not chapter['chapter'] == "hidden":
<li>
<li>
<h2><a
href=
"${reverse('courseware_chapter', args=format_url_params([chapter['course'], chapter['chapter']])) }"
>
<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
import
json
%>
%>
...
@@ -57,21 +58,21 @@ $(function () {
...
@@ -57,21 +58,21 @@ $(function () {
category_total_label = section['
category
'] + " Total"
category_total_label = section['
category
'] + " Total"
series.append({
series.append({
'
label
' : category_total_label,
'
label
' : category_total_label,
'
data
' : [ [tickIndex, section['
totalscore
']
['
score
']
] ],
'
data
' : [ [tickIndex, section['
totalscore
']] ],
'
color
' : colors[sectionIndex]
'
color
' : colors[sectionIndex]
})
})
ticks.append( [tickIndex, section['
totallabel
']] )
ticks.append( [tickIndex, section['
totallabel
']] )
detail_tooltips[category_total_label] = [section['
totalscore
']['
summary
']]
detail_tooltips[category_total_label] = [section['
totalscore
_
summary
']]
else:
else:
series.append({
series.append({
'
label
' : section['
category
'],
'
label
' : section['
category
'],
'
data
' : [ [tickIndex, section['
totalscore
']
['
score
']
] ],
'
data
' : [ [tickIndex, section['
totalscore
']] ],
'
color
' : colors[sectionIndex]
'
color
' : colors[sectionIndex]
})
})
ticks.append( [tickIndex, section['
totallabel
']] )
ticks.append( [tickIndex, section['
totallabel
']] )
detail_tooltips[section['
category
']] = [section['
totalscore
']['
summary
']]
detail_tooltips[section['
category
']] = [section['
totalscore
_
summary
']]
tickIndex += 1 + sectionSpacer
tickIndex += 1 + sectionSpacer
sectionIndex += 1
sectionIndex += 1
...
@@ -86,12 +87,12 @@ $(function () {
...
@@ -86,12 +87,12 @@ $(function () {
overviewBarX = tickIndex
overviewBarX = tickIndex
for section in grade_summary:
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
'])
summary_text = "{0} - {1:.1%} of a possible {2:.0%}".format(section['
category
'], weighted_score, section['
weight
'])
weighted_category_label = section['
category
'] + " - Weighted"
weighted_category_label = section['
category
'] + " - Weighted"
if section['
totalscore
']
['
score
']
> 0:
if section['
totalscore
'] > 0:
series.append({
series.append({
'
label
' : weighted_category_label,
'
label
' : weighted_category_label,
'
data
' : [ [overviewBarX, weighted_score] ],
'
data
' : [ [overviewBarX, weighted_score] ],
...
@@ -101,7 +102,7 @@ $(function () {
...
@@ -101,7 +102,7 @@ $(function () {
detail_tooltips[weighted_category_label] = [ summary_text ]
detail_tooltips[weighted_category_label] = [ summary_text ]
sectionIndex += 1
sectionIndex += 1
totalWeight += section['
weight
']
totalWeight += section['
weight
']
totalScore += section['
totalscore
']
['
score
']
* section['
weight
']
totalScore += section['
totalscore
'] * section['
weight
']
ticks += [ [overviewBarX, "Total"] ]
ticks += [ [overviewBarX, "Total"] ]
tickIndex += 1 + sectionSpacer
tickIndex += 1 + sectionSpacer
...
@@ -128,7 +129,7 @@ $(function () {
...
@@ -128,7 +129,7 @@ $(function () {
legend
:
{
show
:
false
},
legend
:
{
show
:
false
},
};
};
var
$grade_detail_graph
=
$
(
"#
grade-detail-graph
"
);
var
$grade_detail_graph
=
$
(
"#
${graph_div_id}
"
);
if
(
$grade_detail_graph
.
length
>
0
)
{
if
(
$grade_detail_graph
.
length
>
0
)
{
var
plot
=
$
.
plot
(
$grade_detail_graph
,
series
,
options
);
var
plot
=
$
.
plot
(
$grade_detail_graph
,
series
,
options
);
...
@@ -137,7 +138,7 @@ $(function () {
...
@@ -137,7 +138,7 @@ $(function () {
}
}
var
previousPoint
=
null
;
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
));
$
(
"#x"
).
text
(
pos
.
x
.
toFixed
(
2
));
$
(
"#y"
).
text
(
pos
.
y
.
toFixed
(
2
));
$
(
"#y"
).
text
(
pos
.
y
.
toFixed
(
2
));
if
(
item
)
{
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