From 4992be76c6e059248b6bfdfa1c750ecb5b9be9a9 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Fri, 3 Feb 2012 17:03:24 -0500 Subject: [PATCH 1/3] Added links from profile page back to courseware. This is also the last commit with the course overview graph enabled. It is about to be removed. --- accordion.html | 6 +++++- profile.html | 25 ++++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/accordion.html b/accordion.html index b9502acb9c..bf3332d788 100644 --- a/accordion.html +++ b/accordion.html @@ -1,3 +1,7 @@ +<%! + from django.core.urlresolvers import reverse +%> + <%def name="make_chapter(chapter)">

${chapter['name']}

@@ -9,7 +13,7 @@ % endif > - +

${section['name']}

diff --git a/profile.html b/profile.html index c846178b06..3a9646614c 100644 --- a/profile.html +++ b/profile.html @@ -1,5 +1,9 @@ <%inherit file="main.html" /> +<%! + from django.core.urlresolvers import reverse +%> + <%block name="headextra"> @@ -86,16 +90,27 @@ $(function() {

Course Progress

- - +
+
    + <% + lastChapter = None + %> % for hw in homeworks:
  1. -

    ${ hw['chapter'] }

    + %if hw['chapter'] != lastChapter: +

    + ${ hw['chapter'] }

    + <% lastChapter = hw['chapter'] %> + %else: +

    -

    + %endif
    -

    ${ hw['section'] } ${"({0}/{1})".format( hw['section_total'][0], hw['section_total'][1] )}

    - +

    + ${ hw['section'] } ${"({0}/{1})".format( hw['section_total'][0], hw['section_total'][1] )}

    + +
      % for score in hw['scores']:
    • ${ score[0] }/${ score[1] }
    • From 9c94ef9c685fd3462fa2226f618ed0e9b3288489 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Fri, 3 Feb 2012 17:04:59 -0500 Subject: [PATCH 2/3] Removed course overview graph, (course detail graph still remains). --- profile.html | 3 +- profile_graphs.js | 79 ----------------------------------------------- 2 files changed, 1 insertion(+), 81 deletions(-) diff --git a/profile.html b/profile.html index 3a9646614c..343a6b98e4 100644 --- a/profile.html +++ b/profile.html @@ -90,8 +90,7 @@ $(function() {

      Course Progress

      -
      - +
        <% lastChapter = None diff --git a/profile_graphs.js b/profile_graphs.js index 66d5576267..18a6928eab 100644 --- a/profile_graphs.js +++ b/profile_graphs.js @@ -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('
        ${"{:.0%}".format(totalScore)}
        '); - - - $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; - } - }); - } }); From eb31a163fac8b4b69e467e237f76894daaaf2521 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Fri, 3 Feb 2012 17:17:04 -0500 Subject: [PATCH 3/3] Added percentages to sections in profile --- profile.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/profile.html b/profile.html index 343a6b98e4..cd933d1836 100644 --- a/profile.html +++ b/profile.html @@ -107,10 +107,17 @@ $(function() {

        - ${ hw['section'] } ${"({0}/{1})".format( hw['section_total'][0], hw['section_total'][1] )}

        - + <% + earned = hw['section_total'][0] + total = hw['section_total'][1] + percentageString = "{:.0%}".format( float(earned)/total) if earned > 0 else "" + %> + ${ hw['section'] } ${"({}/{}) {}".format( earned, total, percentageString )}
          + %if len(hw['scores']) > 0: + Problem Scores: + %endif % for score in hw['scores']:
        • ${ score[0] }/${ score[1] }
        • % endfor