Compare commits

...

3 Commits

Author SHA1 Message Date
1a19540b30 Reformat 2024-02-14 12:34:58 +01:00
bb8012fecb Ignore .idea 2024-02-14 12:34:55 +01:00
e286fe397d Update templates 2024-02-14 12:34:47 +01:00
7 changed files with 76 additions and 3 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
.vscode
__pycache__
instance/formula10.db
.idea

View File

@ -30,10 +30,10 @@ def default_statistic(year):
@app.route("/seasons/<year>/<statistic>/")
def seasons(year, statistic):
seasons = db.session.execute(db.select(Season)).all() # For season selector
seasons = db.session.execute(db.select(Season)).all() # For season selector
# @todo
races = db.session.execute(db.select(Race).where(Race.year==year)).all()
races = db.session.execute(db.select(Race).where(Race.year == year)).all()
print(races[0].raceId)
# results = dict()

View File

@ -8,7 +8,7 @@ import re
db = SQLAlchemy()
# Modeling these entities separately should make it easier to add new guess categories, for example team guesses or GP guesses
# Modeling these entities separately should make it easier to add new guess categories, e.g. team guesses or GP guesses
def optional_date(date_string):

View File

View File

View File

@ -0,0 +1,48 @@
<table class="table table-bordered">
<thead>
<tr>
<th scope="col" colspan="2" rowspan="3" class="text-center">Race</th>
<th scope="col" colspan="{{ users | length * 2 }}" class="text-center">Call</th>
<th scope="col" rowspan="2" colspan="2" class="text-center">Result</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2">&nbsp;</td>
{% for user in users %}
<td colspan="2" class="text-center">{{ user.name }}</td>
{% endfor %}
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
{% for user in users %}
<td class="text-center">P10</td>
<td class="text-center">DNF</td>
{% endfor %}
<td class="text-center">P10</td>
<td class="text-center">DNF</td>
</tr>
{% for raceresult in raceresults %}
<tr>
<td>{{ raceresult.race.number }}</td>
<td>{{ raceresult.race.grandprix.name }}</td>
{% for user in users %}
{% set p10 = guesses.get(raceresult.race_id).get(user.name).p10.name %}
{% set dnf = guesses.get(raceresult.race_id).get(user.name).dnf.name %}
<td class="{% if p10 == raceresult.p10.name %}text-success fw-bold{% endif %}">{{ p10 }}</td>
<td class="{% if dnf == raceresult.dnf.name %}text-success fw-bold{% endif %}">{{ dnf }}</td>
{% endfor %}
<td>{{ raceresult.p10.name }}</td>
<td class="{% if raceresult.dnf.name == 'NONE' %}text-muted{% endif %}">{{ raceresult.dnf.name }}</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -0,0 +1,24 @@
<table class="table table-bordered">
<thead>
<tr>
<th scope="col" class="text-center">Grand Prix</th>
<th scope="col" class="text-center">Date</th>
<th scope="col" class="text-center">Winner</th>
<th scope="col" class="text-center">Constructor</th>
<th scope="col" class="text-center">Laps</th>
<th scope="col" class="text-center">Best Lap</th>
</tr>
</thead>
<tbody>
{% for race in races %}
<tr>
<td>{{ race.name }}</td>
<td>{{ race.date }}</td>
<td>Winner</td>
<td>Constructor</td>
<td>Laps</td>
<td>Best Lap</td>
</tr>
{% endfor %}
</tbody>
</table>