@extends('admin.layout') @section('content')

Leaderboard

Track student performance and rankings across different subjects and levels

Total Participants

{{ number_format($totalParticipants) }}

Top Score

@if($leaderboard->count() > 0) {{ $leaderboard->first()->total_score }} @else 0 @endif

Average Score

{{ number_format($averageScore, 1) }}

Active Filters

{{ request()->anyFilled(['subject', 'level', 'region', 'school', 'search']) ? count(request()->all()) - 1 : 0 }}

@forelse($leaderboard as $index => $entry) @empty @endforelse
Rank Student Subject Level Score Time Spent School Region Last Updated
@if($index < 3)
@else
{{ $index + 1 }}
@endif #{{ ($leaderboard->currentPage() - 1) * $leaderboard->perPage() + $index + 1 }}
{{ substr($entry->user->first_name, 0, 1) }}{{ substr($entry->user->last_name, 0, 1) }}
{{ $entry->user->first_name }} {{ $entry->user->last_name }}
{{ $entry->user->email }}
{{ $entry->subject->name ?? 'N/A' }}
{{ $entry->competitionLevel->name ?? 'N/A' }}
{{ $entry->total_score }}
points
@php $hours = floor($entry->time_spent / 3600); $minutes = floor(($entry->time_spent % 3600) / 60); $seconds = $entry->time_spent % 60; @endphp @if($hours > 0) {{ $hours }}h {{ $minutes }}m @elseif($minutes > 0) {{ $minutes }}m {{ $seconds }}s @else {{ $seconds }}s @endif {{ $entry->school ?? 'N/A' }} {{ $entry->region ?? 'N/A' }} {{ $entry->updated_at->diffForHumans() }}

No leaderboard entries found.

@if(request()->anyFilled(['subject', 'level', 'region', 'school', 'search']))

Try adjusting your filters

@endif
@if($leaderboard->hasPages())
{{ $leaderboard->withQueryString()->links() }}
@endif
@if($leaderboard->count() > 0)

Top Performers

@foreach($leaderboard->take(3) as $index => $topPerformer)
@if($index == 0)
@elseif($index == 1)
@else
@endif

{{ $topPerformer->user->first_name }} {{ $topPerformer->user->last_name }}

{{ $topPerformer->school ?? 'N/A' }}

{{ $topPerformer->total_score }}

points • {{ $topPerformer->subject->name ?? 'N/A' }}

Level {{ $topPerformer->competitionLevel->level ?? 'N/A' }} {{ $topPerformer->region ?? 'N/A' }}
@endforeach
@endif @endsection