]> ToastFreeware Gitweb - philipp/winterrodeln/wradmin.git/commitdiff
Implement update_wrreportcache functionality via GUI.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 25 Oct 2019 14:58:26 +0000 (14:58 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 25 Oct 2019 14:58:26 +0000 (14:58 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wradmin/trunk@2834 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wradmin/__init__.py
wradmin/controllers/bericht.py
wradmin/templates/bericht_list.html

index c80fc17d6d08371e62d04ecad9d5c842263cc5f5..6d8684f37dfbb1286cfa00637da26e6005b1f1ee 100644 (file)
@@ -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()
index e8f2f690e2b158d79d1cae9150e01f078639b1b1..2fb93e5cb9a46e1a16789f7308bc6e4cf9a02045 100644 (file)
@@ -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'))
index a02d6464508cb4c12ab43bfe119081841d8e0ed3..0b63beab9340b8ee6626acc9f63a039e8e69b7ce 100644 (file)
@@ -4,6 +4,9 @@
 {% block content %}
 <h2>Rodelbahnberichte</h2>
 
+<a href="{{url_for('bericht_update_reportcache')}}" class="button">Berichtzusammenfassung aktualisieren</a>
+
+
 <p>{{paginator.pager('$link_first $link_previous $first_item bis $last_item von $item_count $link_next $link_last') | safe}}</p>
 
 <table>