Commit 40a58a43 authored by Andreas Valder's avatar Andreas Valder
Browse files

added a statistic for lectures per semester

parent 00db1c00
......@@ -10,6 +10,7 @@ def stats():
statsqueries = {}
statsqueries['course_count'] = "SELECT count(id) as count, semester FROM courses GROUP BY semester;"
statsqueries['lectures_count'] = "SELECT count(lectures.id) as count, semester FROM lectures JOIN courses on courses.id=lectures.course_id GROUP BY semester;"
@app.route('/stats/data/<dataname>')
@app.route('/stats/data/<dataname>/<parameter>')
......
......@@ -13,32 +13,55 @@
<h1 class="panel-title">Statistiken</h1>
</div>
<div class="panel-body">
<div id="tester" style="width:600px;height:600px;"></div>
<script>
$.ajax({
method: "GET",
url: "/stats/data/course_count",
dataType: "json",
error: moderator.api.handleapierror,
success: function (data) {
var semester = [];
var y = [];
for (var i=0; i < data.length; i++) {
if (data[i].semester != "") {
semester.push(data[i].semester);
y.push(data[i].count);
<div class="row col-xs-12">
<div id="coursespersemester" style="height:600px;" class="col-xs-6" ></div>
<script>
$.ajax({
method: "GET",
url: "/stats/data/course_count",
dataType: "json",
error: moderator.api.handleapierror,
success: function (data) {
var trace = {"y": [], "x": [], "type": "scatter"};
for (var i=0; i < data.length; i++) {
if (data[i].semester != "") {
trace.x.push(data[i].semester)
trace.y.push(data[i].count)
}
}
var layout = {
"title": 'Veranstaltungen pro Semester',
"showlegend": false
};
Plotly.newPlot('coursespersemester', [trace], layout, { "modeBarButtonsToRemove": ['sendDataToCloud','hoverCompareCartesian'], "displaylogo": false});
}
var trace = {"y": y, "x": semester, "type": "scatter"};
var layout = {
"title": 'Veranstaltungen pro Semester',
"showlegend": false
};
Plotly.newPlot('tester', [trace], layout, { "showLink": false, "modeBarButtonsToRemove": ['sendDataToCloud','hoverCompareCartesian'], "displaylogo": false});
}
});
</script>
</div>
});
</script>
<div id="lecturespersemester" style="height:600px" class="col-xs-6"></div>
<script>
$.ajax({
method: "GET",
url: "/stats/data/lectures_count",
dataType: "json",
error: moderator.api.handleapierror,
success: function (data) {
var trace = {"y": [], "x": [], "type": "scatter"};
for (var i=0; i < data.length; i++) {
if (data[i].semester != "") {
trace.x.push(data[i].semester)
trace.y.push(data[i].count)
}
}
var layout = {
"title": 'Aufnahmen pro Semester',
"showlegend": false
};
Plotly.newPlot('lecturespersemester', [trace], layout, { "modeBarButtonsToRemove": ['sendDataToCloud','hoverCompareCartesian'], "displaylogo": false});
}
});
</script>
</div>
i </div>
</div>
</div>
{% endblock %}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment