/
estab.html
101 lines (85 loc) · 3.52 KB
/
estab.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
{% extends "base.html" %}
{% block rest_insp_list %}
<div id="estab_container">
<h2 id="estab_name_header">{{ estab.0.estab_id.name }}, {{ estab.0.estab_id.address}}</h2>
<hr class="style-one">
<div class="clear_floats"></div>
<!--<div id="list4-estab_summary">
<ul>
{% for inspection in estab %}
<li><a href="/insps/{{ inspection.inspection_key }}/">{{ inspection.date }}: {{ inspection.demerits_nums }} demerit{{ inspection.demerits_nums|pluralize }}.</li></a>
{% endfor %}
</ul>
</div>-->
{% if estab.count > 1 %}
<div id="estab_chart">
<script type="text/javascript">
var json = [
{% for inspection in estab %}
{
"date": "{{ inspection.date }}",
"demerits": {{ inspection.demerits_nums }},
'inspection_key': "{{ inspection.inspection_key }}"
}{% if not loop.last %}, {% endif %}
{% endfor %}
];
var demerits_js = new Array;
var dates_js = new Array();
$.map(json, function(obj, i) {
demerits_js.push({ y: parseInt(obj.demerits), inspection_key: obj.inspection_key });
dates_js.push((obj.date));
});
$(function () {
$('#estab_chart').highcharts({
chart: {
type: 'scatter'
},
title: {
text: 'Inspection Results',
style: {
fontFamily:'Georgia, Times, serif'
}
},
subtitle: {
text: 'San Antonio Metropolitan Health District',
style: {
fontFamily:'Georgia, Times, serif'
}
},
xAxis: {
categories: dates_js
},
yAxis: {
title: {
text: 'Demerits'
}
},
tooltip: {
enabled: true,
formatter: function() {
return 'Demerits: ' + this.point.y + '<br>' + '<a href="http://localhost:8000/insps/' + this.point.inspection_key + '/">Inspection details.';
}
},
series: [{
showInLegend: false,
data: demerits_js,
animation: {
duration: 4000
},
marker: {
enabled: true,
symbol: 'circle',
radius: 9,
fillColor: 'red'
}
}]
});
});
</script>
</div>
{% endif %}
<!--<div id="inspection_exposi">
<p class="estab_page_text">this is a paragraph detailing the city's policy about how thye inspect restaurants. i'd write in here for example how they inspect restaurants more often when they're doing poorly and progressive less often as they get better. i'm not sure what the threshold is.</p>
</div>-->
</div>
{% endblock %}