Events are sorted by date

Closes: #16
This commit is contained in:
Edward Betts 2023-10-05 11:07:01 +01:00
parent 81d7d62620
commit e56cf111e8
3 changed files with 68 additions and 10 deletions

View file

@ -1,3 +1,5 @@
{# vim: set ft=htmljinja
#}
<!doctype html>
<html lang="en">
<head>
@ -7,6 +9,22 @@
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
</head>
{% set event_labels = {
"next_economist": "The Economist",
"mothers_day": "Mothers' day",
"fathers_day": "Fathers' day",
"uk_financial_year_end": "End of financial year",
"bank_holiday": "UK bank holiday",
"us_holiday": "US holiday",
"uk_clock_change": "UK clock change",
"us_clock_change": "US clock change",
"next_us_presidential_election": "US pres. election",
"xmas_last_second": "Christmas last posting 2nd class",
"xmas_last_first": "Christmas last posting 1st class",
"xmas_day": "Christmas day",
}
%}
<body>
<div class="container mt-2">
@ -17,7 +35,7 @@
<li>GBPUSD: {{"{:,.3f}".format(gbpusd)}}</li>
{# <li>lock down:
{{"{:.1f}".format(lockdown_days)}} days
({{"{:.2f}".format(lockdown_days / 7)}} weeks) so far</li> #}
({{"{:.2f}".format(lockdown_days / 7)}} weeks) so far</li>
<li>The Economist: {{days(next_economist)}} (Thursday)</li>
<li>Mothers' day:
@ -43,17 +61,17 @@
{{us_holiday["title"]}}</li>
<li>UK clock change:
{{days(uk_clock_change.date())}}
{{days(uk_clock_change)}}
{{uk_clock_change.strftime("%a, %d, %b %Y")}}</li>
<li>US clock change:
{{days(us_clock_change.date())}}
{{days(us_clock_change)}}
{{us_clock_change.strftime("%a, %d, %b %Y")}}</li>
{#
<li>general election:
{{days(next_uk_general_election)}}
{{next_uk_general_election.strftime("%a, %d %b %Y")}}</li> #}
{{next_uk_general_election.strftime("%a, %d %b %Y")}}</li>
<li>US pres. election:
{{days(next_us_presidential_election)}}
{{next_us_presidential_election.strftime("%a, %d %b %Y")}}</li>
@ -70,9 +88,27 @@
{{days(xmas_day)}}
{{xmas_day.strftime("%a, %d %b %Y")}}</li>
#}
</ul>
<table class="table table-hover w-auto">
{% for event in events %}
<tr>
<td class="text-end">
{{event.date.strftime("%a, %d, %b %Y")}}
</td>
<td>
{{ event_labels[event.name] }}
{%- if "title" in event -%}: {{ event.title }}{% endif %}
</td>
<td class="text-end">
{{ days(event.date) }}
</td>
{% endfor %}
</table>
<h3>Stock markets</h3>
{% for market in stock_markets %}
<p>{{ market }}</p>
@ -113,5 +149,7 @@
</table>
</div>
<pre>{{ events | pprint }}</pre>
</body>
</html>