remove elo (#1304)

This commit is contained in:
NotSoToothless
2026-06-05 12:57:20 -07:00
committed by GitHub
parent a8317575a3
commit e2d02a34b3
18 changed files with 112 additions and 297 deletions
+23 -137
View File
@@ -166,24 +166,6 @@
margin-top: 0.2rem;
}
.stat-card-performance .stat-label {
margin-top: 0;
margin-bottom: 0.35rem;
}
.stat-card-performance {
min-height: 78px;
}
.stat-performance-wrap {
width: 100%;
margin-top: 0.35rem;
}
.stat-performance-wrap .sq-performance-bar {
width: 100%;
}
.members-section {
background: rgba(30, 30, 30, 0.6);
border-radius: 1rem;
@@ -646,51 +628,6 @@
color: rgba(255, 255, 255, 0.8);
}
/* Cumulative performance bar */
.sq-mini-graph {
width: 160px;
min-height: 40px;
margin: 0 auto;
display: flex;
align-items: center;
}
.sq-performance-bar {
width: 100%;
display: flex;
align-items: center;
gap: 0.55rem;
}
.sq-performance-bar-track {
position: relative;
flex: 1;
height: 12px;
border-radius: 999px;
overflow: hidden;
background: rgba(255, 255, 255, 0.08);
border: 1px solid rgba(144, 238, 144, 0.16);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
.sq-performance-bar-fill {
height: 100%;
border-radius: inherit;
background: linear-gradient(90deg, rgba(245, 245, 220, 0.96), rgba(144, 238, 144, 0.96));
box-shadow: 0 0 14px rgba(144, 238, 144, 0.25);
transition: width 0.35s ease;
}
.sq-performance-bar-value {
min-width: 2.75rem;
text-align: right;
font-variant-numeric: tabular-nums;
font-size: 0.9rem;
font-weight: 700;
color: #F5F5DC;
letter-spacing: 0.02em;
}
/* Games section */
.sq-games-section {
background: rgba(30, 30, 30, 0.6);
@@ -940,8 +877,6 @@
const summaryKps = typeof squadronData.squadron_summary.kps === 'number'
? squadronData.squadron_summary.kps.toFixed(2)
: (Number(squadronData.squadron_summary.kps || 0)).toFixed(2);
const summaryPerformance = Math.max(0, Math.min(5, Number(squadronData.squadron_summary.performance || 0)));
const summaryPerformanceWidth = summaryPerformance * 20;
%>
<div class="squadron-stats-summary">
<% if (squadronData.squadron_summary.points && squadronData.squadron_summary.points.has_points_data) { %>
@@ -978,18 +913,6 @@
<span class="stat-number" id="sq-stat-kps"><%= summaryKps %></span>
<div class="stat-label">KPS</div>
</div>
<div class="stat-card stat-card-performance">
<div class="stat-label">ELO</div>
<div id="sq-stat-performance" class="stat-performance-wrap">
<div class="sq-performance-bar" role="progressbar" aria-valuemin="0" aria-valuemax="5" aria-valuenow="<%= summaryPerformance %>" aria-label="ELO <%= summaryPerformance.toFixed(2) %>">
<div class="sq-performance-bar-track">
<div class="sq-performance-bar-fill" style="width:<%= summaryPerformanceWidth %>%;"></div>
</div>
<span class="sq-performance-bar-value"><%= summaryPerformance.toFixed(2) %></span>
</div>
</div>
</div>
<div class="stat-card">
<span class="stat-number" id="sq-stat-ground-kills"><%= squadronData.squadron_summary.ground_kills %></span>
<div class="stat-label"><%= t('common.groundKills') %></div>
@@ -1135,12 +1058,9 @@
<th class="sortable" onclick="sortMembersTable('nick')" data-sort="nick">
<%= t('common.player') %> <i class="fas fa-sort sort-icon"></i>
</th>
<th class="sortable" onclick="sortMembersTable('performance')" data-sort="performance">
ELO <i class="fas fa-sort sort-icon"></i>
</th>
<th class="sortable" onclick="sortMembersTable('sqb_points')" data-sort="sqb_points">
<%= t('common.points') %> <i class="fas fa-sort sort-icon"></i>
</th>
<th class="sortable" onclick="sortMembersTable('sqb_points')" data-sort="sqb_points">
<%= t('common.points') %> <i class="fas fa-sort sort-icon"></i>
</th>
<th class="sortable" onclick="sortMembersTable('total_battles')" data-sort="total_battles">
<%= t('common.battles') %> <i class="fas fa-sort sort-icon"></i>
</th>
@@ -1177,24 +1097,10 @@
</tr>
</thead>
<tbody id="sq-members-table-body">
<%
const buildEfficiencyBar = (score) => {
const rating = Math.max(0, Math.min(5, Number(score) || 0));
return `
<div class="sq-performance-bar" role="progressbar" aria-valuemin="0" aria-valuemax="5" aria-valuenow="${rating}" aria-label="ELO ${rating.toFixed(2)}">
<div class="sq-performance-bar-track">
<div class="sq-performance-bar-fill" style="width:${rating * 20}%;"></div>
</div>
<span class="sq-performance-bar-value">${rating.toFixed(2)}</span>
</div>
`;
};
%>
<% squadronData.players.forEach(player => { const score = Math.max(0, Math.min(5, Number(player.performance || 0))); %>
<tr class="row-link">
<td class="player-name"><a href="/players/<%= player.uid %>" class="row-link-overlay" aria-label="View <%= player.nick %>"></a><%= player.nick %><button class="pdm-details-btn" onclick="event.stopPropagation(); openPlayerDetailsModal('<%= player.uid %>', '<%= player.nick.replace(/'/g, "\\'") %>')" title="<%= t('squadrons.quickDetails') %>"><i class="fas fa-eye"></i></button></td>
<td class="stat-cell" data-performance-cell data-sort-value="<%= score %>"><div class="sq-mini-graph"><%- buildEfficiencyBar(score) %></div></td>
<td class="stat-cell"><%= player.sqb_points || 0 %></td>
<% squadronData.players.forEach(player => { %>
<tr class="row-link">
<td class="player-name"><a href="/players/<%= player.uid %>" class="row-link-overlay" aria-label="View <%= player.nick %>"></a><%= player.nick %><button class="pdm-details-btn" onclick="event.stopPropagation(); openPlayerDetailsModal('<%= player.uid %>', '<%= player.nick.replace(/'/g, "\\'") %>')" title="<%= t('squadrons.quickDetails') %>"><i class="fas fa-eye"></i></button></td>
<td class="stat-cell"><%= player.sqb_points || 0 %></td>
<td class="stat-cell"><%= player.total_battles %></td>
<td class="stat-cell"><%= player.wins %></td>
<td class="stat-cell"><%= player.win_rate.toFixed(1) %>%</td>
@@ -2443,11 +2349,6 @@
setText('sq-stat-assists', s.assists);
setText('sq-stat-deaths', s.deaths);
setText('sq-stat-captures', s.captures);
const performanceWrap = getElement('sq-stat-performance');
if (performanceWrap) {
const score = Math.max(0, Math.min(5, Number(s.performance || 0)));
performanceWrap.innerHTML = buildEfficiencyBarHtml(score);
}
}
function escapeHtml(str) {
@@ -3107,27 +3008,14 @@
renderPerformanceView();
};
function buildEfficiencyBarHtml(score) {
const rating = Math.max(0, Math.min(5, Number(score) || 0));
return `
<div class="sq-performance-bar" role="progressbar" aria-valuemin="0" aria-valuemax="5" aria-valuenow="${rating}" aria-label="ELO ${rating.toFixed(2)}">
<div class="sq-performance-bar-track">
<div class="sq-performance-bar-fill" style="width:${rating * 20}%;"></div>
</div>
<span class="sq-performance-bar-value">${rating.toFixed(2)}</span>
</div>
`;
}
function renderMembersTable(players) {
function renderMembersTable(players) {
const tbody = getElement('sq-members-table-body');
if (!tbody) return;
if (!players.length) {
tbody.innerHTML = '';
document.querySelectorAll('.sq-mini-graph').forEach(wrap => { wrap.innerHTML = ''; });
return;
}
if (!players.length) {
tbody.innerHTML = '';
return;
}
tbody.innerHTML = players.map(p => {
const nickRaw = p.nick || '';
@@ -3136,13 +3024,11 @@
const winRate = (typeof p.win_rate === 'number' ? p.win_rate.toFixed(1) : (p.win_rate || 0)) + '%';
const kdr = typeof p.kdr === 'number' ? p.kdr.toFixed(2) : (p.kdr || 0);
const kps = typeof p.kps === 'number' ? p.kps.toFixed(2) : (Number(p.kps) || 0).toFixed(2);
const performanceValue = Math.max(0, Math.min(5, Number(p.performance || 0)));
return '<tr data-uid="' + escapeHtml(String(p.uid)) + '" class="row-link">' +
'<td class="player-name"><a href="/players/' + encodeURIComponent(p.uid) + '" class="row-link-overlay" aria-label="View ' + nickEsc + '"></a>' + nickEsc +
'<button class="pdm-details-btn" onclick="event.stopPropagation(); openPlayerDetailsModal(\'' + p.uid + '\', \'' + nickJs + '\')" title="' + __t('squadrons.quickDetails') + '">' +
'<i class="fas fa-eye"></i></button></td>' +
'<td class="stat-cell" data-performance-cell data-sort-value="' + performanceValue + '"><div class="sq-mini-graph" id="sq-cumulative-spark-' + escapeHtml(String(p.uid)) + '">' + buildEfficiencyBarHtml(performanceValue) + '</div></td>' +
'<td class="stat-cell">' + (p.sqb_points || 0) + '</td>' +
return '<tr data-uid="' + escapeHtml(String(p.uid)) + '" class="row-link">' +
'<td class="player-name"><a href="/players/' + encodeURIComponent(p.uid) + '" class="row-link-overlay" aria-label="View ' + nickEsc + '"></a>' + nickEsc +
'<button class="pdm-details-btn" onclick="event.stopPropagation(); openPlayerDetailsModal(\'' + p.uid + '\', \'' + nickJs + '\')" title="' + __t('squadrons.quickDetails') + '">' +
'<i class="fas fa-eye"></i></button></td>' +
'<td class="stat-cell">' + (p.sqb_points || 0) + '</td>' +
'<td class="stat-cell">' + (p.total_battles || 0) + '</td>' +
'<td class="stat-cell">' + (p.wins || 0) + '</td>' +
'<td class="stat-cell">' + winRate + '</td>' +
@@ -3157,12 +3043,12 @@
'</tr>';
}).join('');
// Reset sort state so the next call lands on desc instead of toggling
try { currentSort = { field: '', direction: 'desc' }; } catch (e) { /* no-op */ }
if (typeof sortMembersTable === 'function') {
sortMembersTable('performance');
}
}
// Reset sort state so the next call lands on desc instead of toggling
try { currentSort = { field: '', direction: 'desc' }; } catch (e) { /* no-op */ }
if (typeof sortMembersTable === 'function') {
sortMembersTable('sqb_points');
}
}
initSeasons();
renderMembersTable(currentSquadronPlayers);