@extends('backend.student_backend.student_dashboard') @section('student')

Exam | Details

{{-- Alert messages --}} @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif
@if($cbtTests->isEmpty())

No CBT tests available at the moment

@else @php // Get the logged-in student record $student = \App\Models\Student::where('user_id', \Illuminate\Support\Facades\Auth::id())->first(); $studentId = $student?->id; @endphp
@foreach($cbtTests as $test) @php // Check if this student has attempted this test $attempt = \Illuminate\Support\Facades\DB::table('cbt_attempts') ->where('student_id', $studentId) ->where('cbt_test_id', $test->id) ->latest() ->first(); @endphp @php $minutes = $test->duration_minutes; $hours = floor($minutes / 60); $remainingMinutes = $minutes % 60; if ($hours > 0 && $remainingMinutes > 0) { $formattedDuration = $hours . 'hr ' . $remainingMinutes . 'mins'; } elseif ($hours > 0) { $formattedDuration = $hours . 'hr'; } else { $formattedDuration = $remainingMinutes . 'mins'; } @endphp @endforeach
Class Subject Assessment Total Scores Start Time Duration End Time Action
{{ strtoupper($test->class->class_name) }} {{ ucwords(strtolower($test->subject->subject_name)) }} {{ $test->assessment_type }} @if($attempt && $attempt->score !== null) {{ $attempt->score }} @else - @endif {{ $test->start_time ? \Carbon\Carbon::parse($test->start_time)->format('d M Y, h:i A') : 'No Start Time' }} {{ $formattedDuration }} {{ $test->end_time ? \Carbon\Carbon::parse($test->end_time)->format('d M Y, h:i A') : 'No End Time' }} @if(!$attempt) {{-- No attempt yet --}} Start Test @elseif($attempt->status === 'in_progress') In Progress @elseif($attempt->status === 'completed') @else @endif
@endif
@endsection