Skip to content

Commit 146b0e8

Browse files
committed
init
0 parents  commit 146b0e8

File tree

95 files changed

+14482
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+14482
-0
lines changed

db.sqlite3

40 KB
Binary file not shown.

grades/__init__.py

Whitespace-only changes.

grades/__init__.pyc

130 Bytes
Binary file not shown.

grades/models.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from django.db import models
2+
from django.db.models import permalink
3+
4+
class Course(models.Model):
5+
name = models.CharField("Name", max_length=100)
6+
short_name = models.CharField("Short name", max_length=50)
7+
code = models.CharField("Code", max_length=15)
8+
9+
def __unicode__(self):
10+
return self.code
11+
12+
@permalink
13+
def get_absolute_url(self):
14+
return ('course', None, {'course_id': self.id,})
15+
16+
class Grade(models.Model):
17+
course = models.ForeignKey(Course)
18+
semester_code = models.CharField("Semester", max_length=10)
19+
20+
a = models.SmallIntegerField(default = 0)
21+
b = models.SmallIntegerField(default = 0)
22+
c = models.SmallIntegerField(default = 0)
23+
d = models.SmallIntegerField(default = 0)
24+
e = models.SmallIntegerField(default = 0)
25+
f = models.SmallIntegerField(default = 0)
26+
27+
def __unicode__(self):
28+
return self.semester_code

grades/models.pyc

1.59 KB
Binary file not shown.

grades/static/css/jquery.jqplot.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

grades/static/js/gradestats.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
$(function() {
2+
var graph;
3+
4+
/* AJAX SETUP FOR CSRF */
5+
$.ajaxSetup({
6+
crossDomain: false, // obviates need for sameOrigin test
7+
beforeSend: function(xhr, settings) {
8+
if (!csrfSafeMethod(settings.type)) {
9+
xhr.setRequestHeader("X-CSRFToken", $.cookie('csrftoken'));
10+
}
11+
}
12+
});
13+
function csrfSafeMethod(method) {
14+
// these HTTP methods do not require CSRF protection
15+
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
16+
}
17+
/* END AJAX SETUP */
18+
19+
function createGraph(data){
20+
$.jqplot.config.enablePlugins = true;
21+
s1 = [data.fields.a, data.fields.b, data.fields.c, data.fields.d, data.fields.e, data.fields.f]
22+
ticks = ['A', 'B', 'C', 'D', 'E', 'F'];
23+
graph = $.jqplot('grades-graph', [s1],
24+
{
25+
seriesColors: [ "#00CC00", "#00CC33", "#CCFF33", "#FFFF00", "#FF6600", "#CC0000"],
26+
27+
seriesDefaults:
28+
{
29+
renderer:$.jqplot.BarRenderer,
30+
pointLabels: { show: true },
31+
rendererOptions: { barMargin: 2, varyBarColor: true},
32+
},
33+
axes:
34+
{
35+
xaxis:
36+
{
37+
renderer: $.jqplot.CategoryAxisRenderer,
38+
ticks: ticks,
39+
tickOptions: { showGridLine: false },
40+
},
41+
yaxis:
42+
{
43+
tickOptions: { show: false}
44+
}
45+
},
46+
grid:{ gridLineColor: '#FFF',}
47+
});
48+
}
49+
50+
function createButtons(json){
51+
for(i = 0; i < json.length; i++){
52+
$("#grade-buttons").append("<button type=\"button\" id=" + i + " class=\"btn-grade btn btn-default\">" + json[i].fields.semester_code + "</button>");
53+
}
54+
55+
$(".btn-grade").first().addClass("active");
56+
57+
$(".btn-grade").bind('click', function(event){
58+
$(".btn-grade").removeClass("active");
59+
$(event.target).addClass("active");
60+
data = json[event.target.id];
61+
s1 = [data.fields.a, data.fields.b, data.fields.c, data.fields.d, data.fields.e, data.fields.f];
62+
graph.replot({data:[s1]});
63+
});
64+
}
65+
66+
67+
68+
$(document).ready(function()
69+
{
70+
$.getJSON("grades/", function(json)
71+
{
72+
createGraph(json[0]);
73+
createButtons(json);
74+
});
75+
});
76+
77+
});
78+

grades/static/js/jqplot.barRenderer.min.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)