diff --git a/views/search_results.tpl b/views/search_results.tpl
index 58c20ff..71e2b24 100644
--- a/views/search_results.tpl
+++ b/views/search_results.tpl
@@ -14,6 +14,11 @@
1000-1499 L |
500-999 L |
+
+ | Actuellement |
+ {{current_1000}} |
+ {{current_500}} |
+
% for x in results:
| {{x.date.strftime('%A')}} |
@@ -32,13 +37,44 @@
y: {{ [d.price for d in results] }},
type: 'scatter',
name: '1000-1499 L',
+ marker: {
+ color: '#1f77b4',
+ },
},
{
x: {{ [str(d.date) for d in results if d.price500 is not None] }},
y: {{ [d.price500 for d in results if d.price500 is not None] }},
type: 'scatter',
name: '500-999 L',
- }];
+ marker: {
+ color: '#ff7f0e',
+ },
+ },
+ {
+ x: [new Date().toJSON().slice(0, 10)],
+ y: [{{ current_1000 }}],
+ type: 'scatter',
+ name: 'today',
+ showlegend: false,
+ mode: 'markers',
+ marker: {
+ symbol: 'cross',
+ color: '#1f77b4',
+ },
+ },
+ {
+ x: [new Date().toJSON().slice(0, 10)],
+ y: [{{ current_500 }}],
+ type: 'scatter',
+ name: 'today',
+ showlegend: false,
+ mode: 'markers',
+ marker: {
+ symbol: 'cross',
+ color: '#ff7f0e',
+ },
+ },
+ ];
var plotLayout = {
margin: { t: 0 }
};
diff --git a/webapp.py b/webapp.py
index e548b9c..d15ca46 100644
--- a/webapp.py
+++ b/webapp.py
@@ -4,6 +4,7 @@ import os
from bottle import hook, request, route, run, static_file, view
import models
+from fioul import get_today_prices_from_internet
from models import Price
# ----------------------------------------------------------------------
@@ -14,6 +15,7 @@ from models import Price
@view("search_results", template_settings={"noescape": True})
def results_page():
results = Price.select().order_by(Price.date.desc())
+ current_500, current_1000 = get_today_prices_from_internet()
day_classes = {
0: "monday",
1: "tuesday",
@@ -23,7 +25,12 @@ def results_page():
5: "saturday",
6: "sunday",
}
- return dict(results=results, day_classes=day_classes)
+ return dict(
+ results=results,
+ day_classes=day_classes,
+ current_500=current_500,
+ current_1000=current_1000,
+ )
@route("/static/")