Add prices for lower quantities (500-999L)

Don't forget to run the migratedb command
This commit is contained in:
2022-08-16 00:39:22 +02:00
parent b5e981291f
commit 10d288f3c1
3 changed files with 95 additions and 16 deletions

View File

@@ -9,22 +9,36 @@
<body>
<h1>Prix du m³ de fioul pour Languidic</h1>
<table id="results" class="u-full-width">
<tr>
<th colspan="2"></th> <!-- Date -->
<th>1000-1499 L</th>
<th>500-999 L</th>
</tr>
% for x in results:
<tr class="{{day_classes[x.date.weekday()]}}">
<td>{{x.date.strftime('%A')}}</td>
<td>{{x.date.strftime('%d %b %Y')}}</td>
<td>{{x.price}}</td>
</tr>
<tr class="{{day_classes[x.date.weekday()]}}">
<td>{{x.date.strftime('%A')}}</td>
<td>{{x.date.strftime('%d %b %Y')}}</td>
<td>{{x.price}}</td>
<td>{{x.price500 if x.price500 is not None else "---"}}</td>
</tr>
% end
</table>
<div id="price-plot"></div>
<script>
var plotDiv = document.getElementById('price-plot');
var plotData = [{
x: {{ [str(d.date) for d in results] }},
y: {{ [d.price for d in results] }},
type: 'scatter',
}];
var plotData = [
{
x: {{ [str(d.date) for d in results] }},
y: {{ [d.price for d in results] }},
type: 'scatter',
name: '1000-1499 L',
},
{
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',
}];
var plotLayout = {
margin: { t: 0 }
};