Commit a9761c66 authored by Andreas Valder's avatar Andreas Valder
Browse files

Merge branch 'master' of git.fsmpi.rwth-aachen.de:videoagwebsite/videoagwebsite

parents a78ccce1 e3495a26
from server import * from server import *
import threading import threading
import sched import sched
from time import sleep
scheduler = sched.scheduler() scheduler = sched.scheduler()
def run_scheduler(): def run_scheduler():
time.sleep(1) # UWSGI does weird things on startup sleep(1) # UWSGI does weird things on startup
while True: while True:
scheduler.run() scheduler.run()
time.sleep(10) sleep(10)
def sched_func(delay, priority=0, firstdelay=None, args=[], kargs={}): def sched_func(delay, priority=0, firstdelay=None, args=[], kargs={}):
if firstdelay == None: if firstdelay == None:
......
...@@ -14,7 +14,6 @@ import math ...@@ -14,7 +14,6 @@ import math
import locale import locale
import base64 import base64
import json import json
import time
locale.setlocale(locale.LC_ALL, 'de_DE.utf8') locale.setlocale(locale.LC_ALL, 'de_DE.utf8')
......
...@@ -2,7 +2,7 @@ from server import * ...@@ -2,7 +2,7 @@ from server import *
import json import json
from jobs import date_json_handler from jobs import date_json_handler
from hashlib import md5 from hashlib import md5
import datetime from datetime import datetime
@app.route('/internal/stats') @app.route('/internal/stats')
@app.route('/internal/stats/<semester>') @app.route('/internal/stats/<semester>')
...@@ -13,11 +13,11 @@ def stats(): ...@@ -13,11 +13,11 @@ def stats():
for s in semester: for s in semester:
year = int(s['semester'][0:4]) year = int(s['semester'][0:4])
if s['semester'].endswith('ss'): if s['semester'].endswith('ss'):
s['from'] = datetime.datetime(year,4,1) s['from'] = datetime(year,4,1)
s['to'] = datetime.datetime(year,10,1) s['to'] = datetime(year,10,1)
if s['semester'].endswith('ws'): if s['semester'].endswith('ws'):
s['from'] = datetime.datetime(year,10,1) s['from'] = datetime(year,10,1)
s['to'] = datetime.datetime(year+1,4,1) s['to'] = datetime(year+1,4,1)
return render_template('stats.html',semester=semester,filter=request.args.get('filter')) return render_template('stats.html',semester=semester,filter=request.args.get('filter'))
statsqueries = {} statsqueries = {}
...@@ -117,7 +117,7 @@ def stats_viewsperday(req, param=""): ...@@ -117,7 +117,7 @@ def stats_viewsperday(req, param=""):
expr = queries[req].replace('%T', '"'+query(date_subexpr%('viewsperday.'+req), param)[0]['t']+'"') expr = queries[req].replace('%T', '"'+query(date_subexpr%('viewsperday.'+req), param)[0]['t']+'"')
params = [param]*expr.count('?') params = [param]*expr.count('?')
try: try:
modify(update_expr%('viewsperday.'+req, expr), param, *(params+[datetime.datetime.combine(datetime.date.today(), datetime.time())])) modify(update_expr%('viewsperday.'+req, expr), param, *(params+[datetime.combine(date.today(), time())]))
modify('COMMIT') modify('COMMIT')
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
......
Markdown is supported
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