Auto commit: 2026-02-18T23:10:07.481Z

This commit is contained in:
Flatlogic Bot 2026-02-18 23:10:07 +00:00
parent da13426e59
commit 0d7553ebfc
2 changed files with 8 additions and 4 deletions

View File

@ -205,7 +205,7 @@ $requests_today = $stmt->fetchColumn();
</div>
<div class="col-md-4">
<div class="card p-4 h-100 border-info" style="background: rgba(13, 202, 240, 0.05);">
<h5><i class="bi bi-trophy-fill text-info"></i> Ranking de Oyentes (Top 5)</h5>
<h5><i class="bi bi-trophy-fill text-info"></i> Oyentes de la Semana (Top 5)</h5>
<div id="top-requesters" class="mt-3">
<p class="text-secondary text-center">Cargando ranking...</p>
</div>
@ -610,8 +610,11 @@ $requests_today = $stmt->fetchColumn();
requestersDiv.innerHTML = '<div class="list-group list-group-flush bg-transparent">' +
data.data.map((item, index) => `
<div class="list-group-item bg-transparent text-white border-secondary d-flex justify-content-between align-items-center">
<span>${index + 1}. ${item.requester}</span>
<span class="badge bg-info rounded-pill">${item.total_requests} peticiones</span>
<span>
${index === 0 ? '<i class="bi bi-crown-fill text-warning me-1"></i>' : (index + 1) + '. '}
<span class="${index === 0 ? 'fw-bold text-warning' : ''}">${item.requester}</span>
</span>
<span class="badge ${index === 0 ? 'bg-warning text-dark' : 'bg-info'} rounded-pill">${item.total_requests} peticiones</span>
</div>
`).join('') + '</div>';
}

View File

@ -4,11 +4,12 @@ require_once __DIR__ . '/../db/config.php';
try {
$pdo = db();
// Obtener el Top 5 de usuarios que más canciones han pedido
// Obtener el Top 5 de usuarios que más canciones han pedido en los últimos 7 días
$stmt = $pdo->query("
SELECT requester, COUNT(*) as total_requests
FROM song_requests
WHERE requester IS NOT NULL AND requester != '' AND requester != 'Anónimo'
AND created_at > DATE_SUB(NOW(), INTERVAL 7 DAY)
GROUP BY requester
ORDER BY total_requests DESC
LIMIT 5