Skip to content

Commit 32f0c62

Browse files
committed
feat: implement past seasons info
1 parent f5745de commit 32f0c62

3 files changed

Lines changed: 73 additions & 27 deletions

File tree

app/controllers/seasons_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ def show
2323
leaguepedia.schedule(tournament)
2424
end
2525

26-
# Fallback: compute standings from schedule when TournamentResults is empty
26+
# Fallback 1: compute standings from schedule when TournamentResults is empty
2727
if @standings.blank? && @schedule.any?
2828
@standings = leaguepedia.standings_from_schedule(@schedule)
2929
end
30+
# Fallback 2: use static standings hardcoded in SEASONS_DATA
31+
@standings = @season_data[:static_standings] if @standings.blank? && @season_data[:static_standings]
3032

3133
@champion_stats = CacheService.fetch("champion_stats:#{@slug}", :champion_stats) do
3234
leaguepedia.champion_stats(tournament)

app/views/seasons/show.html.erb

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,45 @@
1616
<% if @standings.any? %>
1717
<table style="width:100%;border-collapse:collapse">
1818
<thead>
19+
<% has_wl = @standings.any? { |r| r["Wins"] } %>
1920
<tr style="border-bottom:1px solid var(--retro-gold-dim)">
2021
<th class="retro-table-head" style="text-align:center;width:32px">#</th>
2122
<th class="retro-table-head" style="text-align:left">Time</th>
22-
<th class="retro-table-head" style="text-align:center">V</th>
23-
<th class="retro-table-head" style="text-align:center">D</th>
24-
<th class="retro-table-head" style="text-align:center">WR%</th>
23+
<% if has_wl %>
24+
<th class="retro-table-head" style="text-align:center">V</th>
25+
<th class="retro-table-head" style="text-align:center">D</th>
26+
<th class="retro-table-head" style="text-align:center">WR%</th>
27+
<% end %>
2528
</tr>
2629
</thead>
2730
<tbody>
2831
<% @standings.each_with_index do |row, idx| %>
32+
<% place = row["Place"] || (idx + 1).to_s %>
33+
<% champion = @season_data[:champion] == row["Team"] %>
2934
<tr class="retro-table-row" style="border-bottom:1px solid rgba(200,155,60,0.08)">
3035
<td style="padding:10px 8px;text-align:center;white-space:nowrap">
31-
<span style="font-size:17px;font-weight:bold;color:<%= idx.zero? ? 'var(--retro-gold)' : 'rgba(255,255,255,0.4)' %>;font-family:var(--retro-font)"><%= idx + 1 %></span>
32-
<% if idx.zero? %><span style="font-size:16px;margin-left:2px">🏆</span><% end %>
36+
<span style="font-size:17px;font-weight:bold;color:<%= place == "1" ? 'var(--retro-gold)' : 'rgba(255,255,255,0.4)' %>;font-family:var(--retro-font)"><%= place %></span>
37+
<% if champion %><span style="font-size:16px;margin-left:2px">🏆</span><% end %>
3338
</td>
3439
<td style="padding:10px 8px 10px 0">
3540
<div style="display:flex;align-items:center;gap:8px">
3641
<%= team_logo(row["Team"], size: 26) %>
3742
<span style="font-size:17px;font-weight:bold;color:rgba(255,255,255,0.85);font-family:var(--retro-font)"><%= row["Team"] %></span>
3843
</div>
3944
</td>
40-
<td style="padding:10px 8px;text-align:center">
41-
<span style="font-size:16px;font-weight:bold;color:var(--color-kl-win);font-family:var(--retro-font)"><%= row["Wins"] %></span>
42-
</td>
43-
<td style="padding:10px 8px;text-align:center">
44-
<span style="font-size:16px;font-weight:bold;color:var(--color-kl-loss);font-family:var(--retro-font)"><%= row["Losses"] %></span>
45-
</td>
46-
<td style="padding:10px 8px;text-align:center">
47-
<% w = row["Wins"].to_i; l = row["Losses"].to_i; t = w + l %>
48-
<% pct = t.zero? ? 0 : (w.to_f / t * 100).round %>
49-
<span style="font-size:17px;font-weight:bold;font-family:var(--retro-font);color:<%= pct >= 60 ? 'var(--color-kl-win)' : (pct >= 40 ? 'rgba(255,255,255,0.6)' : 'var(--color-kl-loss)') %>"><%= pct %>%</span>
50-
</td>
45+
<% if has_wl %>
46+
<td style="padding:10px 8px;text-align:center">
47+
<span style="font-size:16px;font-weight:bold;color:var(--color-kl-win);font-family:var(--retro-font)"><%= row["Wins"] %></span>
48+
</td>
49+
<td style="padding:10px 8px;text-align:center">
50+
<span style="font-size:16px;font-weight:bold;color:var(--color-kl-loss);font-family:var(--retro-font)"><%= row["Losses"] %></span>
51+
</td>
52+
<td style="padding:10px 8px;text-align:center">
53+
<% w = row["Wins"].to_i; l = row["Losses"].to_i; t = w + l %>
54+
<% pct = t.zero? ? 0 : (w.to_f / t * 100).round %>
55+
<span style="font-size:17px;font-weight:bold;font-family:var(--retro-font);color:<%= pct >= 60 ? 'var(--color-kl-win)' : (pct >= 40 ? 'rgba(255,255,255,0.6)' : 'var(--color-kl-loss)') %>"><%= pct %>%</span>
56+
</td>
57+
<% end %>
5158
</tr>
5259
<% end %>
5360
</tbody>

config/initializers/kings_lendas_teams.rb

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,56 @@
8787
},
8888

8989
# Season 3 (extra teams)
90-
"100Vices" => { abbr: "100", slug: "100vices", parody_of: "100 Thieves", color: "#E63946" },
91-
"FONatic" => { abbr: "FNC", slug: "fonatic", parody_of: "Fnatic", color: "#FF8C00" },
92-
"G12 Esports" => { abbr: "G12", slug: "g12-esports", parody_of: "G2 Esports", color: "#00FF87" },
93-
"Oreiudos Esports" => { abbr: "ORE", slug: "oreiudos-esports", parody_of: "Cloud9", color: "#1DA1F2" },
94-
"paiNtriotas" => { abbr: "PNG", slug: "paintriotas", parody_of: "paiN Gaming", color: "#7B2D8B" },
95-
"Tepei Assassins" => { abbr: "TEP", slug: "tepei-assassins", parody_of: "Team Liquid", color: "#009FDA" },
96-
"ÉanDG" => { abbr: "EDG", slug: "eandg", parody_of: "EDward Gaming", color: "#FF4500" }
90+
"100Vices" => { abbr: "100", slug: "100vices", parody_of: "100 Thieves", color: "#E63946", logo: "/Teams/Seasons/3/100Vices.webp" },
91+
"FONatic" => { abbr: "FNC", slug: "fonatic", parody_of: "Fnatic", color: "#FF8C00", logo: "/Teams/Seasons/3/FONatic.webp" },
92+
"G12 Esports" => { abbr: "G12", slug: "g12-esports", parody_of: "G2 Esports", color: "#00FF87", logo: "/Teams/Seasons/2/g12.webp" },
93+
"G12" => { abbr: "G12", slug: "g12-esports", parody_of: "G2 Esports", color: "#00FF87", logo: "/Teams/Seasons/2/g12.webp" },
94+
"Oreiudos Esports" => { abbr: "ORE", slug: "oreiudos-esports", parody_of: "Cloud9", color: "#1DA1F2", logo: "/Teams/Seasons/2/Oreiudos.webp" },
95+
"paiNtriotas" => { abbr: "PNG", slug: "paintriotas", parody_of: "paiN Gaming", color: "#7B2D8B", logo: "/Teams/Seasons/3/PaiNtriotas.webp" },
96+
"Tepei Assassins" => { abbr: "TEP", slug: "tepei-assassins", parody_of: "Team Liquid", color: "#009FDA", logo: "/Teams/Seasons/2/Tepei.webp" },
97+
"Tepei Esports" => { abbr: "TEP", slug: "tepei-assassins", parody_of: "Team Liquid", color: "#009FDA", logo: "/Teams/Seasons/2/Tepei.webp" },
98+
"ÉanDG" => { abbr: "EDG", slug: "eandg", parody_of: "EDward Gaming", color: "#FF4500", logo: "/Teams/Seasons/3/EanDG.webp" }
9799
}.freeze
98100

99101
SEASONS_DATA = {
100-
"season-1" => { name: "Kings Lendas Season 1", leaguepedia_name: "IDL Kings Lendas", label: "Season 1" },
101-
"season-2" => { name: "Kings Lendas Season 2", leaguepedia_name: "IDL Kings Lendas Season 2", label: "Season 2", champion: "Karmine Cospe" },
102-
"season-3" => { name: "Kings Lendas Season 3", leaguepedia_name: "IDL Kings Lendas Season 3", label: "Season 3", champion: "Gen GG" },
102+
"season-1" => {
103+
name: "Kings Lendas Season 1", leaguepedia_name: "IDL Kings Lendas", label: "Season 1",
104+
champion: "Oreiudos Esports",
105+
static_standings: [
106+
{ "Team" => "Oreiudos Esports", "Place" => "1", "Wins" => 3, "Losses" => 1 },
107+
{ "Team" => "G12", "Place" => "2", "Wins" => 2, "Losses" => 2 },
108+
{ "Team" => "Tepei Esports", "Place" => "3", "Wins" => 1, "Losses" => 2 },
109+
{ "Team" => "Gen GG", "Place" => "4", "Wins" => 1, "Losses" => 2 }
110+
]
111+
},
112+
"season-2" => {
113+
name: "Kings Lendas Season 2", leaguepedia_name: "IDL Kings Lendas Season 2", label: "Season 2",
114+
champion: "Karmine Cospe",
115+
static_standings: [
116+
{ "Team" => "Karmine Cospe", "Place" => "1", "Wins" => nil, "Losses" => nil },
117+
{ "Team" => "Gen GG", "Place" => "2", "Wins" => nil, "Losses" => nil },
118+
{ "Team" => "Tepei Esports", "Place" => "3-4", "Wins" => nil, "Losses" => nil },
119+
{ "Team" => "G12", "Place" => "3-4", "Wins" => nil, "Losses" => nil },
120+
{ "Team" => "Vôs Grandes", "Place" => "5", "Wins" => nil, "Losses" => nil },
121+
{ "Team" => "Oreiudos Esports", "Place" => "6", "Wins" => nil, "Losses" => nil }
122+
]
123+
},
124+
"season-3" => {
125+
name: "Kings Lendas Season 3", leaguepedia_name: "IDL Kings Lendas Season 3", label: "Season 3",
126+
champion: "Gen GG",
127+
static_standings: [
128+
{ "Team" => "Gen GG", "Place" => "1", "Wins" => nil, "Losses" => nil },
129+
{ "Team" => "Karmine Cospe", "Place" => "2", "Wins" => nil, "Losses" => nil },
130+
{ "Team" => "ÉanDG", "Place" => "3", "Wins" => nil, "Losses" => nil },
131+
{ "Team" => "FONatic", "Place" => "4", "Wins" => nil, "Losses" => nil },
132+
{ "Team" => "Vôs Grandes", "Place" => "5-6", "Wins" => nil, "Losses" => nil },
133+
{ "Team" => "G12", "Place" => "5-6", "Wins" => nil, "Losses" => nil },
134+
{ "Team" => "paiNtriotas", "Place" => "7", "Wins" => nil, "Losses" => nil },
135+
{ "Team" => "100Vices", "Place" => "8", "Wins" => nil, "Losses" => nil },
136+
{ "Team" => "Oreiudos Esports", "Place" => "9", "Wins" => nil, "Losses" => nil },
137+
{ "Team" => "Tepei Esports", "Place" => "10", "Wins" => nil, "Losses" => nil }
138+
]
139+
},
103140
"copa" => { name: "Kings Lendas Cup", leaguepedia_name: "IDL Kings Lendas Cup", label: "Cup 2026" }
104141
}.freeze
105142

0 commit comments

Comments
 (0)