From: philipp Date: Fri, 25 Oct 2019 14:58:26 +0000 (+0000) Subject: Implement update_wrreportcache functionality via GUI. X-Git-Url: https://git.toastfreeware.priv.at/philipp/winterrodeln/wradmin.git/commitdiff_plain/2cf4f3b35ca678c082eed9ef7a4dbe651b189870 Implement update_wrreportcache functionality via GUI. git-svn-id: http://www.winterrodeln.org/svn/wradmin/trunk@2834 7aebc617-e5e2-0310-91dc-80fb5f6d2477 --- diff --git a/wradmin/__init__.py b/wradmin/__init__.py index c80fc17..6d8684f 100644 --- a/wradmin/__init__.py +++ b/wradmin/__init__.py @@ -73,6 +73,11 @@ def bericht_change_date_invalid(id): return BerichtController().change_date_invalid(id) +@app.route("/bericht/update_reportcache") +def bericht_update_reportcache(): + return BerichtController().update_reportcache() + + @app.route("/gasthaus/list") def gasthaus_list(): return GasthausController().list() diff --git a/wradmin/controllers/bericht.py b/wradmin/controllers/bericht.py index e8f2f69..2fb93e5 100644 --- a/wradmin/controllers/bericht.py +++ b/wradmin/controllers/bericht.py @@ -3,6 +3,7 @@ from flask import request, abort, redirect, url_for, flash, render_template import paginate import sqlalchemy as sa import wradmin.model as model +import wrpylib.wrmwcache class BerichtController: @@ -66,3 +67,15 @@ class BerichtController: model.meta.Session.commit() flash('Datum wurde erfolgreich geändert') return redirect(url_for('bericht_view', id=id)) + + def update_reportcache(self): + """Updates the wrreportcache table.""" + c = model.meta.Session.connection() + try: + wrpylib.wrmwcache.update_wrreportcache(c) + model.meta.Session.commit() + flash('Die Berichtzusammenfassung-Tabelle wurde erfolgreich aktualisiesrt.', 'info') + except wrpylib.wrmwcache.UpdateCacheError as e: + flash(str(e), 'error') + # Redirect to result page + return redirect(url_for('bericht_list')) diff --git a/wradmin/templates/bericht_list.html b/wradmin/templates/bericht_list.html index a02d646..0b63bea 100644 --- a/wradmin/templates/bericht_list.html +++ b/wradmin/templates/bericht_list.html @@ -4,6 +4,9 @@ {% block content %}

Rodelbahnberichte

+Berichtzusammenfassung aktualisieren + +

{{paginator.pager('$link_first $link_previous $first_item bis $last_item von $item_count $link_next $link_last') | safe}}