@if(count($reportData) > 0) @foreach($reportData as $index => $data) @php $percentage = $data['percentage']; $progressLevel = $data['progress_level']; $status = $data['completed'] == 0 ? 'not-attempted' : ($data['completed'] < $data['total'] ? 'partial' : 'completed'); // Time formatting $avgTimeFormatted = ''; if ($data['avg_time_per_question'] > 0) { $minutes = floor($data['avg_time_per_question'] / 60); $seconds = $data['avg_time_per_question'] % 60; $avgTimeFormatted = "{$minutes}m {$seconds}s"; } // Total time formatting $totalTimeFormatted = ''; if ($data['total_time_seconds'] > 0) { $totalHours = floor($data['total_time_seconds'] / 3600); $totalMinutes = floor(($data['total_time_seconds'] % 3600) / 60); $totalSeconds = $data['total_time_seconds'] % 60; if ($totalHours > 0) { $totalTimeFormatted = "{$totalHours}h {$totalMinutes}m"; } else { $totalTimeFormatted = "{$totalMinutes}m {$totalSeconds}s"; } } // Determine rank badge $rank = $data['rank']; $showRankBadge = $rank <= 3 && $data['completed'] > 0; $rankColors = [ 1 => ['bg' => '#fbbf24', 'text' => '#92400e', 'icon' => 'fas fa-trophy', 'label' => '1st'], 2 => ['bg' => '#d1d5db', 'text' => '#374151', 'icon' => 'fas fa-medal', 'label' => '2nd'], 3 => ['bg' => '#b45309', 'text' => '#fef3c7', 'icon' => 'fas fa-award', 'label' => '3rd'] ]; @endphp
{{ substr($data['student']->name, 0, 1) }}

{{ $data['student']->name }} @if($showRankBadge) {{ $rankColors[$rank]['label'] }} @endif

{{ $data['student']->regno }} @if($data['completed'] > 0) Rank: {{ $rank }} @endif
Completed {{ $data['completed'] }}/{{ $data['total'] }}
Progress {{ $percentage }}%
@if($data['completed'] > 0)
Avg Time {{ $avgTimeFormatted }}
Total Time {{ $totalTimeFormatted }}
@endif
@if($data['completed'] > 0)
@csrf
@else @endif
@endforeach @else

No Data Available

{{ isset($search) && $search ? 'No students match your search criteria.' : 'No student data found for this topic.' }}

@endif