Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Video AG Infrastruktur
website
Commits
ded2aab0
Commit
ded2aab0
authored
Nov 10, 2016
by
Andreas Valder
Browse files
added a first statistic for a test
parent
373f200e
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
server.py
View file @
ded2aab0
...
...
@@ -539,12 +539,6 @@ def auth(): # For use with nginx auth_request
return
Response
(
"Login required"
,
401
,
{
'WWW-Authenticate'
:
'Basic realm="Login Required"'
})
return
"Not allowed"
,
403
@
app
.
route
(
'/stats'
)
@
register_navbar
(
'Statistiken'
,
icon
=
'stats'
)
@
mod_required
def
stats
():
return
render_template
(
'stats.html'
)
@
app
.
route
(
'/changelog'
)
@
register_navbar
(
'Changelog'
,
icon
=
'book'
)
@
mod_required
...
...
@@ -609,6 +603,7 @@ def sitemap():
import
feeds
import
importer
import
stats
import
sorter
if
'ICAL_URL'
in
config
:
import
meetings
...
...
static/plotly.min.js
0 → 100644
View file @
ded2aab0
This diff is collapsed.
Click to expand it.
stats.py
0 → 100644
View file @
ded2aab0
from
server
import
*
import
json
@
app
.
route
(
'/stats'
)
@
register_navbar
(
'Statistiken'
,
icon
=
'stats'
)
@
mod_required
def
stats
():
return
render_template
(
'stats.html'
)
statsqueries
=
{}
statsqueries
[
'course_count'
]
=
"SELECT count(id) as count, semester FROM courses GROUP BY semester;"
@
app
.
route
(
'/stats/data/<dataname>'
)
@
app
.
route
(
'/stats/data/<dataname>/<parameter>'
)
@
mod_required
def
stats_data
(
dataname
,
parameter
=
None
):
if
parameter
:
data
=
query
(
statsqueries
[
dataname
],
parameter
)
else
:
data
=
query
(
statsqueries
[
dataname
])
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
templates/base.html
View file @
ded2aab0
...
...
@@ -25,7 +25,9 @@
<script
src=
"{{url_for('static', filename='jquery.js')}}"
></script>
<script
src=
"{{url_for('static', filename='bootstrap/bootstrap.js')}}"
></script>
<script
src=
"{{url_for('static', filename='js.cookie.js')}}"
></script>
{%if ismod() %}
<script
src=
"{{url_for('static', filename='moderator.js')}}"
></script>
{% endif %}
{%if ismod() %}
<script
src=
"{{url_for('static', filename='moderator.js')}}"
></script>
{% endif %}
<script
src=
"{{url_for('static', filename='videojs/video.js')}}"
></script>
<script
src=
"{{url_for('static', filename='videojs/ie8/videojs-ie8.js')}}"
></script>
<script
src=
"{{url_for('static', filename='videojs/videojs-resolution-switcher.js')}}"
></script>
...
...
templates/stats.html
View file @
ded2aab0
{% from 'macros.html' import preview %}
{% extends "base.html" %}
{% block header %}
{{ super() }}
<script
src=
"{{url_for('static', filename='plotly.min.js')}}"
></script>
{% endblock %}
{% block content %}
<div
class=
"panel-group"
>
<div
class=
"panel panel-default"
>
...
...
@@ -7,6 +13,29 @@
<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
)
{
console
.
log
(
data
);
var
semester
=
[];
var
y
=
[];
var
x
=
[]
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
semester
.
push
(
data
[
i
].
semester
);
y
.
push
(
data
[
i
].
count
);
x
.
push
(
i
);
}
var
trace
=
{
"
y
"
:
y
,
"
x
"
:
semester
,
"
type
"
:
"
scatter
"
};
console
.
log
(
trace
);
Plotly
.
newPlot
(
'
tester
'
,
[
trace
]);
}
});
</script>
</div>
</div>
</div>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment