Skip to content

Commit 0177bf5

Browse files
committed
Revert "feat: populate seasons page with match history and player stats"
This reverts commit 8561677.
1 parent 8561677 commit 0177bf5

2 files changed

Lines changed: 5 additions & 156 deletions

File tree

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
class SeasonsController < ApplicationController
22
def index
33
set_meta_tags(title: "Temporadas — Kings Lendas")
4-
@seasons = SEASONS_DATA.map { |slug, data| { slug: slug, **data } }
4+
@seasons = SEASONS_DATA.map do |slug, data|
5+
{ slug: slug, **data }
6+
end
57
end
68

79
def show
@@ -14,7 +16,6 @@ def show
1416
set_meta_tags(title: "#{@season_data[:label]} — Kings Lendas")
1517

1618
tournament = @season_data[:leaguepedia_name]
17-
1819
@standings = CacheService.fetch("standings:#{@slug}", :standings) do
1920
leaguepedia.standings(tournament)
2021
end
@@ -23,45 +24,8 @@ def show
2324
leaguepedia.schedule(tournament)
2425
end
2526

26-
# Fallback: compute standings from schedule when TournamentResults is empty
27-
if @standings.blank? && @schedule.any?
28-
@standings = leaguepedia.standings_from_schedule(@schedule)
29-
end
30-
3127
@champion_stats = CacheService.fetch("champion_stats:#{@slug}", :champion_stats) do
3228
leaguepedia.champion_stats(tournament)
3329
end.first(10)
34-
35-
@players = CacheService.fetch("players:#{@slug}", :player_stats) do
36-
raw = leaguepedia.scoreboard_players(tournament)
37-
aggregate_season_players(raw)
38-
end.first(10)
39-
40-
@matches_by_phase = @schedule
41-
.group_by { |m| m["Phase"].presence || "Fase de Grupos" }
42-
end
43-
44-
private
45-
46-
def aggregate_season_players(raw)
47-
return [] if raw.blank?
48-
raw.group_by { |p| p["Link"] }.map do |player, games|
49-
kills = games.sum { |g| g["Kills"].to_i }
50-
deaths = games.sum { |g| g["Deaths"].to_i }
51-
assists = games.sum { |g| g["Assists"].to_i }
52-
kda = deaths.zero? ? (kills + assists).to_f : (kills + assists).to_f / deaths
53-
{
54-
"player" => player,
55-
"team" => games.last["Team"],
56-
"role" => games.last["Role"],
57-
"games" => games.length,
58-
"kills" => kills,
59-
"deaths" => deaths,
60-
"assists" => assists,
61-
"kda" => kda.round(2),
62-
"avg_cs" => (games.sum { |g| g["CS"].to_i }.to_f / games.length).round(1),
63-
"champions" => games.map { |g| g["Champion"] }.tally.sort_by { |_, v| -v }.first(3).map(&:first)
64-
}
65-
end.sort_by { |p| -p["kda"] }
6630
end
6731
end

app/views/seasons/show.html.erb

Lines changed: 2 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -58,124 +58,9 @@
5858
<% end %>
5959
</div>
6060

61-
<!-- Top Players -->
62-
<% if @players.any? %>
63-
<div style="margin-bottom:24px">
64-
<%= retro_panel(title: "Top Jogadores", category: "// ESTATÍSTICAS", footer: @season_data[:name]) do %>
65-
<table style="width:100%;border-collapse:collapse">
66-
<thead>
67-
<tr style="border-bottom:1px solid var(--retro-gold-dim)">
68-
<th class="retro-table-head" style="text-align:left">Jogador</th>
69-
<th class="retro-table-head" style="text-align:left">Time</th>
70-
<th class="retro-table-head" style="text-align:center">GS</th>
71-
<th class="retro-table-head" style="text-align:center">KDA</th>
72-
<th class="retro-table-head" style="text-align:center">K</th>
73-
<th class="retro-table-head" style="text-align:center">D</th>
74-
<th class="retro-table-head" style="text-align:center">A</th>
75-
<th class="retro-table-head" style="text-align:center">CS/j</th>
76-
<th class="retro-table-head" style="text-align:left">Campeões</th>
77-
</tr>
78-
</thead>
79-
<tbody>
80-
<% @players.each do |p| %>
81-
<tr class="retro-table-row" style="border-bottom:1px solid rgba(200,155,60,0.08)">
82-
<td style="padding:9px 8px 9px 0">
83-
<span style="font-size:12px;font-weight:bold;color:rgba(255,255,255,0.85);font-family:var(--retro-font)"><%= p["player"] %></span>
84-
</td>
85-
<td style="padding:9px 8px">
86-
<div style="display:flex;align-items:center;gap:5px">
87-
<%= team_logo(p["team"], size: 18) %>
88-
<span style="font-size:11px;color:rgba(255,255,255,0.4);font-family:var(--retro-font)"><%= team_abbr(p["team"]) %></span>
89-
</div>
90-
</td>
91-
<td style="padding:9px 8px;text-align:center">
92-
<span style="font-size:12px;color:rgba(255,255,255,0.5);font-family:var(--retro-font)"><%= p["games"] %></span>
93-
</td>
94-
<td style="padding:9px 8px;text-align:center">
95-
<span style="font-size:13px;font-weight:bold;font-family:var(--retro-font);color:<%= p["kda"] >= 5 ? '#ecc94b' : (p["kda"] >= 3 ? 'var(--color-kl-win)' : 'rgba(255,255,255,0.7)') %>"><%= p["kda"] %></span>
96-
</td>
97-
<td style="padding:9px 8px;text-align:center"><span style="font-size:12px;color:var(--color-kl-win);font-family:var(--retro-font)"><%= p["kills"] %></span></td>
98-
<td style="padding:9px 8px;text-align:center"><span style="font-size:12px;color:var(--color-kl-loss);font-family:var(--retro-font)"><%= p["deaths"] %></span></td>
99-
<td style="padding:9px 8px;text-align:center"><span style="font-size:12px;color:rgba(255,255,255,0.6);font-family:var(--retro-font)"><%= p["assists"] %></span></td>
100-
<td style="padding:9px 8px;text-align:center"><span style="font-size:12px;color:rgba(255,255,255,0.5);font-family:var(--retro-font)"><%= p["avg_cs"] %></span></td>
101-
<td style="padding:9px 8px">
102-
<div style="display:flex;gap:2px">
103-
<% p["champions"].each do |champ| %>
104-
<%= champion_icon(champ, size: 24) %>
105-
<% end %>
106-
</div>
107-
</td>
108-
</tr>
109-
<% end %>
110-
</tbody>
111-
</table>
112-
<% end %>
113-
</div>
114-
<% end %>
115-
116-
<!-- Match Results -->
117-
<% if @matches_by_phase.any? %>
118-
<div style="margin-bottom:24px">
119-
<%= retro_panel(title: "Partidas", category: "// HISTÓRICO", footer: @season_data[:name]) do %>
120-
<% @matches_by_phase.each do |phase, matches| %>
121-
<div style="margin-bottom:20px">
122-
<div class="retro-sep" style="margin-bottom:12px">
123-
<div class="retro-sep-line"></div>
124-
<span class="retro-sep-label"><%= phase_label(phase) %></span>
125-
<div class="retro-sep-line-r"></div>
126-
</div>
127-
128-
<div style="display:grid;gap:6px">
129-
<% matches.each do |match| %>
130-
<% t1 = match["Team1"]; t2 = match["Team2"] %>
131-
<% winner = match["Winner"]; played = winner.present? %>
132-
<% t1s = match["Team1Score"].to_i; t2s = match["Team2Score"].to_i %>
133-
134-
<div style="border:1px solid <%= played ? 'rgba(200,155,60,0.15)' : 'rgba(5,150,170,0.12)' %>;background:rgba(15,24,35,0.6);padding:10px 14px;display:flex;align-items:center;gap:10px">
135-
<!-- Team 1 -->
136-
<div style="flex:1;display:flex;align-items:center;gap:6px;min-width:0;opacity:<%= played && winner != t1 ? '0.4' : '1' %>">
137-
<%= team_logo(t1, size: 22) %>
138-
<span style="font-size:12px;font-weight:bold;color:rgba(255,255,255,0.85);font-family:var(--retro-font);overflow:hidden;text-overflow:ellipsis;white-space:nowrap"><%= team_abbr(t1) %></span>
139-
</div>
140-
141-
<!-- Score -->
142-
<div style="flex-shrink:0;text-align:center;min-width:56px">
143-
<% if played %>
144-
<div style="display:flex;align-items:center;justify-content:center;gap:4px">
145-
<span style="font-size:18px;font-weight:900;font-family:var(--retro-font);color:<%= winner == t1 ? 'var(--color-kl-win)' : 'rgba(255,255,255,0.2)' %>"><%= t1s %></span>
146-
<span style="color:rgba(255,255,255,0.15);font-size:13px">:</span>
147-
<span style="font-size:18px;font-weight:900;font-family:var(--retro-font);color:<%= winner == t2 ? 'var(--color-kl-win)' : 'rgba(255,255,255,0.2)' %>"><%= t2s %></span>
148-
</div>
149-
<div style="font-size:9px;color:var(--retro-gold-dim);font-family:var(--retro-font);letter-spacing:0.08em;margin-top:1px">
150-
Bo<%= match["BestOf"].to_i > 0 ? match["BestOf"] : 1 %>
151-
</div>
152-
<% else %>
153-
<span style="font-size:14px;font-weight:bold;color:rgba(255,255,255,0.15);font-family:var(--retro-font)">VS</span>
154-
<% end %>
155-
</div>
156-
157-
<!-- Team 2 -->
158-
<div style="flex:1;display:flex;align-items:center;justify-content:flex-end;gap:6px;min-width:0;opacity:<%= played && winner != t2 ? '0.4' : '1' %>">
159-
<span style="font-size:12px;font-weight:bold;color:rgba(255,255,255,0.85);font-family:var(--retro-font);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:right"><%= team_abbr(t2) %></span>
160-
<%= team_logo(t2, size: 22) %>
161-
</div>
162-
163-
<!-- Date -->
164-
<div style="flex-shrink:0;min-width:54px;text-align:right">
165-
<span style="font-size:10px;color:rgba(255,255,255,0.25);font-family:var(--retro-font)"><%= format_datetime_brt(match["DateTime_UTC"]) %></span>
166-
</div>
167-
</div>
168-
<% end %>
169-
</div>
170-
</div>
171-
<% end %>
172-
<% end %>
173-
</div>
174-
<% end %>
175-
176-
<!-- Top Champions -->
61+
<!-- Top champions -->
17762
<% if @champion_stats.any? %>
178-
<%= retro_panel(title: "Top Campeões", category: "// PICKS", footer: @season_data[:name]) do %>
63+
<%= retro_panel(title: "Top Campeões", category: "// ESTATÍSTICAS", footer: @season_data[:name]) do %>
17964
<div style="display:flex;flex-wrap:wrap;gap:12px;padding:4px 0 8px">
18065
<% @champion_stats.each do |champ| %>
18166
<div style="text-align:center;width:58px">

0 commit comments

Comments
 (0)