This commit is contained in:
Edward Betts 2023-01-08 11:49:57 +00:00
parent cbc681ddbc
commit ebe672b972
7 changed files with 286 additions and 117 deletions

View file

@ -5,6 +5,24 @@
<title>Ferries to France</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<!--
<style>
body {
background: black;
color: white;
}
.table { color: white; }
a:link {
color: rgb(127, 127, 255);
}
</style>
-->
</head>
{% from "individual_route.html" import route_table with context %}
@ -12,9 +30,11 @@
<body>
<div class="m-3">
<p>{{ days_until_start }} days until start of Dodainville week: Friday 16 September 2022</p>
<p>{{ days_until_start }} days / {{ (days_until_start / 7) | int }} weeks / {{ "{:.1f}".format(days_until_start / 30.5) }} months until start of Dodainville week: Friday 17 March 2022</p>
{#
<p><a href="{{ url_for(other + "_page") }}">{{ other }}</a></p>
#}
{% if extra_routes %}
<ul>
@ -28,6 +48,10 @@
<h4>{{ dep.title() }} to {{ arr.title() }}</h4>
{{ route_table(dep, arr, days) }}
{% endfor %}
<!--
{{ data | pprint | safe }}
-->
</div>
</body>
</html>

29
templates/base.html Normal file
View file

@ -0,0 +1,29 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>
{% block title %}{% endblock %}
</title>
<style>
/* body {
background: black;
color: white;
} */
</style>
{% block style %}{% endblock %}
</head>
<body>
{% block content %}{% endblock %}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
{% block script %}{% endblock %}
</body>
</html>

View file

@ -5,6 +5,25 @@
<title>Ferries to France</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<!--
<style>
body {
background: black;
color: white;
}
.table { color: white; }
a:link {
color: rgb(127, 127, 255);
}
</style>
-->
</head>
<body>
@ -14,12 +33,12 @@
<p>{{ departure_date }} {{ ticket_tier }}</p>
<table class="table">
<table class="table w-auto">
<tr>
<th>code</th>
<th>description</th>
<th>max adults</th>
<th>quantity available</th>
<th>births</th>
<th>quantity<br/>available</th>
<th>price</th>
</tr>
{% for a in accommodations if a.quantityAvailable > 0 %}
@ -27,12 +46,28 @@
<td>{{ a.code }}</td>
<td>{{ a.description }}</td>
<td>{{ a.maxAdults }}</td>
<td>{{ a.quantityAvailable }}</td>
<td>
{% if a.quantityAvailable == 10 %}
10+
{% else %}
{{ a.quantityAvailable }}
{% endif %}
</td>
<td>£{{ a.unitCost.amount }}</td>
</tr>
{% endfor %}
</table>
<h4>Pet accommodations</h4>
<p>
o.petStayInCar = 'G',<br>
o.petLargeKennel = 'B',<br>
o.petSmallKennel = 'K',<br>
</p>
<pre>{{ pet_accommodations | tojson }}</pre>
</div>
</body>
</html>

View file

@ -11,9 +11,9 @@
<div class="m-3">
<ul>
{% for dep, arr in routes %}
<li><a href="{{ url_for("show_route", departure_port=ports[dep], arrival_port=ports[arr]) }}">{{ dep }} - {{ arr }}</a></li>
{% endfor %}
<li><a href="{{ url_for("outbound1_page") }}">Outbound: 10 March</a>
<li><a href="{{ url_for("outbound2_page") }}">Outbound: 17 March</a>
<li><a href="{{ url_for("return_page") }}">Return: 24 March</a>
</ul>
</div>

View file

@ -1,8 +1,10 @@
{% macro headings() %}
<tr>
<th>ID</th>
<th>day</th>
<th>depart</th>
<th>arrive</th>
<th>duration</th>
<th>ship</th>
<th>economy</th>
<th>standard</th>
@ -17,10 +19,12 @@
{{ headings() }}
{% for day in days %}
{% set date = parse_date(day.date) %}
{% for crossing in day.prices %}
{% for i in day.prices if i.crossingPrices.sailingId not in ("385413", "384486", "386181", "386191", "388752", "385445", "384550") %}
{% set crossing = i.crossingPrices %}
{# <tr><td colspan="7">{{ crossing }}</td></tr> #}
<tr>
<td class="text-nowrap">{{ crossing.sailingId }}</td>
<td class="text-nowrap text-end">{{ date.strftime("%a, %d %b") }}</td>
<td class="text-nowrap">
{{ crossing.departureDateTime.time }}
@ -28,6 +32,9 @@
<td class="text-nowrap">
{{ crossing.arrivalDateTime.time }}
</td>
<td class="text-nowrap">
{{ get_duration(crossing.departureDateTime.time, crossing.arrivalDateTime.time, time_delta) }}
</td>
<td class="text-nowrap">
{{ crossing.shipName }}
</td>
@ -46,6 +53,9 @@
£{{ crossing.flexiPrice.amount }}
</a>
</td>
<td>
{{ format_pet_options(crossing.petAvailabilities) | join(", ") }}
</td>
<td class="text-nowrap">
{% if crossing.full %}full |{% endif %}
{% if crossing.isCabinSpaceFull %}no cabin space |{% endif %}

View file

@ -18,8 +18,6 @@ URL: {{ request.url }}
{{ tb.plaintext | safe }}
{% endset %}
<p><a class="btn btn-primary btn-lg" role="button" href="https://github.com/EdwardBetts/dab-mechanic/issues/new?title={{ tb.exception + " " + request.url | urlencode }}&body={{ body | urlencode }}">Submit as an issue on GitHub</a> (requires an account with GitHub)</p>
<h2 class="traceback">Traceback <em>(most recent call last)</em></h2>
{{ tb.render_summary(include_title=False) | safe }}