Skip to content

Commit 3de828e

Browse files
committed
fix: hide results of season 1838, for which the scores are lost due to a bug
the scores were lost before they could be eternized in the Results table in the database...
1 parent e161abc commit 3de828e

File tree

2 files changed

+85
-84
lines changed

2 files changed

+85
-84
lines changed

src/routes/results.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const setupResultsRoutes = function(app: Express, prisma: PrismaClient):
2222
const { seasonResults, rankings } = await getSeasonResults(prisma, season.id, 10);
2323

2424
return res.render('results.njk', {
25+
seasonId: season.id,
2526
endedSeasons,
2627
season,
2728
seasonResults,

templates/results.njk

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -45,98 +45,98 @@
4545
{% endif %}
4646

4747
<!-- leaderboard result -->
48-
{% if seasonResults | length == 0 %}
48+
{% if seasonResults | length == 0 or seasonId == 1838 %} {# seasonId 1838 is hidden due to broken data #}
4949
<p class="text-muted p-4"><i>No individual coalition results available for this season.</i></p>
50-
{% endif %}
51-
52-
<!-- leaderboards per coalition -->
53-
<!-- this data comes from Codam's coalition system, not from Intra directly -->
54-
{% for seasonResult in seasonResults %}
55-
<div class="card w-100 mb-4" id="leaderboards" style="overflow: hidden;">
56-
<div class="card-header pe-2 d-flex align-items-center" style="background-color: {{ seasonResult.coalition.intra_coalition.color | rgba(0.5) }};">
57-
<h4 class="d-inline-block pe-3 lh-lg flex-grow-1 text-white">{{ seasonResult.coalition.intra_coalition.name | striptags(true) | escape }} Leaderboards</h4>
58-
<div class="d-inline-block">
50+
{% else %}
51+
<!-- leaderboards per coalition -->
52+
<!-- this data comes from Codam's coalition system, not from Intra directly -->
53+
{% for seasonResult in seasonResults %}
54+
<div class="card w-100 mb-4" id="leaderboards" style="overflow: hidden;">
55+
<div class="card-header pe-2 d-flex align-items-center" style="background-color: {{ seasonResult.coalition.intra_coalition.color | rgba(0.5) }};">
56+
<h4 class="d-inline-block pe-3 lh-lg flex-grow-1 text-white">{{ seasonResult.coalition.intra_coalition.name | striptags(true) | escape }} Leaderboards</h4>
57+
<div class="d-inline-block">
5958

59+
</div>
60+
</div>
61+
<div class="">
62+
<ol class="list-group list-group-numbered custom-number noborder">
63+
<li data-number="{{ loop.index }}" class="list-group-item big-coalition-row" style="background-color: {{ seasonResult.coalition.intra_coalition.color | rgba(0.5) }}; background-image: url({{ seasonResult.coalition.intra_coalition.cover_url }})">
64+
<a href="/coalitions/{{ seasonResult.coalition.intra_coalition.id }}">
65+
<div class="big-coalition-logo">
66+
<img src="{{ seasonResult.coalition.intra_coalition.image_url }}" style="filter: invert(1);" />
67+
</div>
68+
<div class="big-coalition-content">
69+
<h4 class="coalition-name"><b>{{ seasonResult.coalition.intra_coalition.name | striptags(true) | escape }}</b></h4>
70+
<p class="coalition-description">{{ seasonResult.score | thousands }} points</p>
71+
</div>
72+
</a>
73+
</li>
74+
</ol>
75+
<table class="table table-striped mb-0">
76+
<tbody>
77+
{% for userScore in seasonResult.scores %}
78+
<tr style="vertical-align: middle;">
79+
<td class="fs-5 p-2" style="width: 25px;">{{ userScore.coalition_rank }}.</td>
80+
<td class="p-0">
81+
<div class="d-inline-flex flex-row justify-content-start align-items-center text-light">
82+
<a href="/profile/{{ userScore.user.intra_user.login }}" class="p-2 text-light" style="text-decoration: none;">
83+
<img loading="lazy" src="{{ userScore.user.intra_user.image }}" class="user-picture rounded-circle d-inline-block me-2" height="32" />
84+
<span>{{ userScore.user.intra_user.usual_full_name | striptags(true) | escape }}</span>
85+
</a>
86+
</div>
87+
</td>
88+
<td class="text-end ps-2 pe-2 mt-0 mb-2">{{ userScore.score | thousands }}</td>
89+
</tr>
90+
{% endfor %}
91+
</tbody>
92+
</table>
93+
{# if no rankings, display a message #}
94+
{% if seasonResult.scores | length == 0 %}
95+
<p class="text-muted p-4"><i>No individual leaderboards available for this coalition.</i></p>
96+
{% endif %}
6097
</div>
6198
</div>
62-
<div class="">
63-
<ol class="list-group list-group-numbered custom-number noborder">
64-
<li data-number="{{ loop.index }}" class="list-group-item big-coalition-row" style="background-color: {{ seasonResult.coalition.intra_coalition.color | rgba(0.5) }}; background-image: url({{ seasonResult.coalition.intra_coalition.cover_url }})">
65-
<a href="/coalitions/{{ seasonResult.coalition.intra_coalition.id }}">
66-
<div class="big-coalition-logo">
67-
<img src="{{ seasonResult.coalition.intra_coalition.image_url }}" style="filter: invert(1);" />
68-
</div>
69-
<div class="big-coalition-content">
70-
<h4 class="coalition-name"><b>{{ seasonResult.coalition.intra_coalition.name | striptags(true) | escape }}</b></h4>
71-
<p class="coalition-description">{{ seasonResult.score | thousands }} points</p>
72-
</div>
73-
</a>
74-
</li>
75-
</ol>
76-
<table class="table table-striped mb-0">
77-
<tbody>
78-
{% for userScore in seasonResult.scores %}
79-
<tr style="vertical-align: middle;">
80-
<td class="fs-5 p-2" style="width: 25px;">{{ userScore.coalition_rank }}.</td>
81-
<td class="p-0">
82-
<div class="d-inline-flex flex-row justify-content-start align-items-center text-light">
83-
<a href="/profile/{{ userScore.user.intra_user.login }}" class="p-2 text-light" style="text-decoration: none;">
84-
<img loading="lazy" src="{{ userScore.user.intra_user.image }}" class="user-picture rounded-circle d-inline-block me-2" height="32" />
85-
<span>{{ userScore.user.intra_user.usual_full_name | striptags(true) | escape }}</span>
86-
</a>
87-
</div>
88-
</td>
89-
<td class="text-end ps-2 pe-2 mt-0 mb-2">{{ userScore.score | thousands }}</td>
90-
</tr>
91-
{% endfor %}
92-
</tbody>
93-
</table>
94-
{# if no rankings, display a message #}
95-
{% if seasonResult.scores | length == 0 %}
96-
<p class="text-muted p-4"><i>No individual leaderboards available for this coalition.</i></p>
97-
{% endif %}
98-
</div>
99-
</div>
100-
{% endfor %}
99+
{% endfor %}
101100

102-
<!-- rankings -->
103-
<!-- this data comes from Codam's coalition system, not from Intra directly -->
104-
{% for ranking in rankings %}
105-
<div class="card w-100 mb-4" id="ranking-{{ ranking.type }}">
106-
<div class="card-header pe-2 d-flex align-items-center" style="background-color: #6c757d;">
107-
<h4 class="d-inline-block pe-3 lh-lg flex-grow-1 text-white">{{ ranking.name | striptags(true) | escape }}</h4>
108-
<div class="d-inline-block">
101+
<!-- rankings -->
102+
<!-- this data comes from Codam's coalition system, not from Intra directly -->
103+
{% for ranking in rankings %}
104+
<div class="card w-100 mb-4" id="ranking-{{ ranking.type }}">
105+
<div class="card-header pe-2 d-flex align-items-center" style="background-color: #6c757d;">
106+
<h4 class="d-inline-block pe-3 lh-lg flex-grow-1 text-white">{{ ranking.name | striptags(true) | escape }}</h4>
107+
<div class="d-inline-block">
109108

109+
</div>
110+
</div>
111+
<div class="card-body p-0">
112+
<p class="p-4 pb-2">{{ ranking.description | striptags(true) | escape | nl2br }}</p>
113+
<table class="table coalition-colored mb-0">
114+
<tbody>
115+
{# TODO: build a nice big highlight of the winner(s) #}
116+
{% for result in ranking.results %}
117+
<tr style="background: {{ result.coalition.intra_coalition.color | rgba(0.25) if result.coalition else 'transparent' }}; vertical-align: middle;">
118+
<td class="fs-5 p-2" style="width: 25px;">{{ result.rank }}.</td>
119+
<td class="p-0">
120+
<div class="d-inline-flex flex-row justify-content-start align-items-center text-light">
121+
<a href="/profile/{{ result.user.intra_user.login | striptags(true) | escape }}" class="p-2 text-light" style="text-decoration: none;">
122+
<img loading="lazy" src="{{ result.user.intra_user.image }}" class="user-picture rounded-circle d-inline-block me-2" height="32" />
123+
<span>{{ result.user.intra_user.usual_full_name | striptags(true) | escape }}</span>
124+
</a>
125+
</div>
126+
</td>
127+
<td class="text-end ps-2 pe-2 mt-0 mb-2">{{ result.score | thousands }}</td>
128+
</tr>
129+
{% endfor %}
130+
</tbody>
131+
</table>
132+
{# if no rankings, display a message #}
133+
{% if ranking.results | length == 0 %}
134+
<p class="text-muted p-4"><i>No rankings available for this season.</i></p>
135+
{% endif %}
110136
</div>
111137
</div>
112-
<div class="card-body p-0">
113-
<p class="p-4 pb-2">{{ ranking.description | striptags(true) | escape | nl2br }}</p>
114-
<table class="table coalition-colored mb-0">
115-
<tbody>
116-
{# TODO: build a nice big highlight of the winner(s) #}
117-
{% for result in ranking.results %}
118-
<tr style="background: {{ result.coalition.intra_coalition.color | rgba(0.25) if result.coalition else 'transparent' }}; vertical-align: middle;">
119-
<td class="fs-5 p-2" style="width: 25px;">{{ result.rank }}.</td>
120-
<td class="p-0">
121-
<div class="d-inline-flex flex-row justify-content-start align-items-center text-light">
122-
<a href="/profile/{{ result.user.intra_user.login | striptags(true) | escape }}" class="p-2 text-light" style="text-decoration: none;">
123-
<img loading="lazy" src="{{ result.user.intra_user.image }}" class="user-picture rounded-circle d-inline-block me-2" height="32" />
124-
<span>{{ result.user.intra_user.usual_full_name | striptags(true) | escape }}</span>
125-
</a>
126-
</div>
127-
</td>
128-
<td class="text-end ps-2 pe-2 mt-0 mb-2">{{ result.score | thousands }}</td>
129-
</tr>
130-
{% endfor %}
131-
</tbody>
132-
</table>
133-
{# if no rankings, display a message #}
134-
{% if ranking.results | length == 0 %}
135-
<p class="text-muted p-4"><i>No rankings available for this season.</i></p>
136-
{% endif %}
137-
</div>
138-
</div>
139-
{% endfor %}
138+
{% endfor %}
139+
{% endif %}
140140
</div>
141141

142142
{% endblock %}

0 commit comments

Comments
 (0)