[Coffee] [PATCH coffee-flask 2/2] Fix not reloading total consumption graphs

Jaroslav Klapalek klapajar at fel.cvut.cz
Fri Sep 14 14:35:34 CEST 2018


Adding timestamp to url for composing the graphs makes the url
different -- thus forcing the website to ask for the graph again
and do not use cached one.
---
 app.py              | 2 +-
 templates/user.html | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app.py b/app.py
index a597ad6..d662c00 100644
--- a/app.py
+++ b/app.py
@@ -53,7 +53,7 @@ def user():
                                count=db.coffee_count(uid, 0),
                                stamp=time.time()
                                )
-    return render_template('user.html')
+    return render_template('user.html', stamp=time.time())
 
 
 @app.route('/user/rename')
diff --git a/templates/user.html b/templates/user.html
index 51a41f6..f680629 100644
--- a/templates/user.html
+++ b/templates/user.html
@@ -28,7 +28,7 @@
             <input id="username" type="text" name="name">
             <input type="button" value="rename" onclick="renameUser()">
         </form>
-    </p
+    </p>
 {% else %}
     <img src="{{ url_for('coffee_graph_history', _external=True, stamp=stamp) }}">
     <img src="{{ url_for('coffee_graph_flavors_history', _external=True, stamp=stamp) }}">
-- 
2.7.4




More information about the Coffee mailing list