merge
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
<%!
|
||||
from django.core.urlresolvers import reverse
|
||||
%>
|
||||
|
||||
<%def name="make_chapter(chapter)">
|
||||
<h3><a href="#">${chapter['name']}</a></h3>
|
||||
|
||||
@@ -9,7 +13,7 @@
|
||||
% endif
|
||||
>
|
||||
|
||||
<a href='/courseware/${format_string(course_name)}/${format_string(chapter['name'])}/${format_string(section['name'])}'>
|
||||
<a href="${reverse('courseware_section', args=format_url_params([course_name, chapter['name'], section['name']]))}">
|
||||
<p>${section['name']}</p>
|
||||
|
||||
<p class="subtitle">
|
||||
|
||||
31
profile.html
31
profile.html
@@ -1,5 +1,9 @@
|
||||
<%inherit file="main.html" />
|
||||
|
||||
<%!
|
||||
from django.core.urlresolvers import reverse
|
||||
%>
|
||||
|
||||
<%block name="headextra">
|
||||
<script type="text/javascript" src="${ settings.LIB_URL }flot/jquery.flot.min.js"></script>
|
||||
<script type="text/javascript" src="${ settings.LIB_URL }flot/jquery.flot.stack.js"></script>
|
||||
@@ -86,17 +90,34 @@ $(function() {
|
||||
<h1>Course Progress</h1>
|
||||
|
||||
<div id="grade-detail-graph" style="width:650px;height:200px;"></div>
|
||||
<!-- <div id="grade-overview-graph" style="width:650px;height:130px;"></div> -->
|
||||
|
||||
|
||||
<ol>
|
||||
<%
|
||||
lastChapter = None
|
||||
%>
|
||||
% for hw in homeworks:
|
||||
<li>
|
||||
<h2>${ hw['chapter'] }</h2>
|
||||
%if hw['chapter'] != lastChapter:
|
||||
<h2><a href="${reverse('courseware_chapter', args=format_url_params([hw['course'], hw['chapter']])) }">
|
||||
${ hw['chapter'] }</a></h2>
|
||||
<% lastChapter = hw['chapter'] %>
|
||||
%else:
|
||||
<h2>-</h2>
|
||||
%endif
|
||||
|
||||
<div class="scores">
|
||||
<h3>${ hw['section'] } ${"({0}/{1})".format( hw['section_total'][0], hw['section_total'][1] )}</h3>
|
||||
|
||||
<h3><a href="${reverse('courseware_section', args=format_url_params([hw['course'], hw['chapter'], hw['section']])) }">
|
||||
<%
|
||||
earned = hw['section_total'][0]
|
||||
total = hw['section_total'][1]
|
||||
percentageString = "{:.0%}".format( float(earned)/total) if earned > 0 else ""
|
||||
%>
|
||||
${ hw['section'] }</a> ${"({}/{}) {}".format( earned, total, percentageString )}</h3>
|
||||
|
||||
<ul>
|
||||
%if len(hw['scores']) > 0:
|
||||
Problem Scores:
|
||||
%endif
|
||||
% for score in hw['scores']:
|
||||
<li>${ score[0] }/${ score[1] }</li>
|
||||
% endfor
|
||||
|
||||
@@ -123,83 +123,4 @@ $(function () {
|
||||
previousPoint = null;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* ------------------------------- Grade overview graph ------------------------------- */
|
||||
series = [];
|
||||
ticks = [];
|
||||
var markings = [];
|
||||
var overview_tooltips = {};
|
||||
<%
|
||||
totalWeight = 0.0
|
||||
sectionIndex = 0
|
||||
totalScore = 0.0
|
||||
%>
|
||||
%for section in grade_summary:
|
||||
%if section['totalscore']['score'] > 0:
|
||||
series.push({label: "${section['category']}",
|
||||
data: [[${section['totalscore']['score'] * section['weight']}, 1]],
|
||||
color: colors[${sectionIndex}].toString(),
|
||||
##We need at least one to be on xaxis 2 for the second xaxis labels to show up
|
||||
${"xaxis: 2" if sectionIndex % 2 == 0 else ""} });
|
||||
%endif
|
||||
|
||||
ticks.push( [${totalWeight + section['weight'] * 0.5}, "${'{} - {:.0%}'.format(section['category'], section['weight'])}" ] );
|
||||
|
||||
markings.push({xaxis: {from: ${totalWeight}, to: ${totalWeight + section['weight']} }, color:colors[${sectionIndex}].scale("a", 0.6).toString() });
|
||||
|
||||
overview_tooltips["${section['category']}"] = [ "${section['totalscore']['summary']}" ];
|
||||
<%
|
||||
sectionIndex += 1
|
||||
totalWeight += section['weight']
|
||||
totalScore += section['totalscore']['score'] * section['weight']
|
||||
%>
|
||||
%endfor
|
||||
|
||||
options = {
|
||||
series: {stack: 0,
|
||||
lines: {show: false, steps: false },
|
||||
bars: {show: true, barWidth: 0.8, align: 'center', horizontal: true, linewidth:0, fill:1},},
|
||||
xaxis: {min: 0.0, max: 1.0},
|
||||
yaxis: {min: 0.0, max: 2.0, labelWidth:50, ticks:[[1.18,"Grade Totals"]], tickLength: 0},
|
||||
xaxes: [ {ticks: [[0.87, "A 87%"], [0.7, "B 70%"], [0.6, "C 60%"]], position: top},
|
||||
{ticks: ticks }],
|
||||
grid: { markings: markings, hoverable: true, clickable: true, borderWidth: 1},
|
||||
legend: {show: false},
|
||||
};
|
||||
|
||||
var $gradeOverviewGraph = $("#grade-overview-graph");
|
||||
if ($gradeOverviewGraph.length > 0) {
|
||||
var plot = $.plot($gradeOverviewGraph, series, options);
|
||||
|
||||
//Put the percent on the graph
|
||||
var o = plot.pointOffset({x: ${totalScore}, y: 1 });
|
||||
$gradeOverviewGraph.append('<div style="position:absolute;left:' + (o.left + 4) + 'px;top:' + (o.top - 10) + 'px">${"{:.0%}".format(totalScore)}</div>');
|
||||
|
||||
|
||||
$gradeOverviewGraph.bind("plothover", function (event, pos, item) {
|
||||
$("#x").text(pos.x.toFixed(2));
|
||||
$("#y").text(pos.y.toFixed(2));
|
||||
if (item) {
|
||||
if (previousPoint != (item.dataIndex, item.seriesIndex)) {
|
||||
previousPoint = (item.dataIndex, item.seriesIndex);
|
||||
|
||||
$("#tooltip").remove();
|
||||
|
||||
if (item.series.label in overview_tooltips) {
|
||||
var series_tooltips = overview_tooltips[item.series.label];
|
||||
if (item.dataIndex < series_tooltips.length) {
|
||||
var x = item.datapoint[0].toFixed(2), y = item.datapoint[1].toFixed(2);
|
||||
|
||||
showTooltip(item.pageX, item.pageY, series_tooltips[item.dataIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
$("#tooltip").remove();
|
||||
previousPoint = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user