@php
$completed_count = (int) ($completed_count ?? 0);
$completed_questions = $completed_questions ?? [];
@endphp
@php
if (!function_exists('formatSeconds')) {
function formatSeconds($seconds) {
$seconds = (int) $seconds;
if ($seconds < 60) return $seconds . ' sec';
if ($seconds < 3600) {
$m = intdiv($seconds, 60);
$s = $seconds % 60;
return $m . ' min ' . $s . ' sec';
}
$h = intdiv($seconds, 3600);
$m = intdiv($seconds % 3600, 60);
return $h . ' hr ' . $m . ' min';
}
}
@endphp
@if($completed_count > 0)
| # |
Question Title |
Difficulty |
Start Time |
End Time |
Time Taken |
Marks |
Completed On |
@foreach($completed_questions as $index => $question)
@php
$questionDetail = $question['details'] ?? null;
$sec = (int) ($question['total_time_seconds'] ?? 0);
$timeTaken = formatSeconds($sec);
$marks = $question['marks'] ?? 'N/A';
$level = strtolower($question['level'] ?? 'unknown');
if ($level == 'easy') {
$difficultyColor = '#10b981';
$difficultyText = 'Easy';
} elseif ($level == 'medium') {
$difficultyColor = '#f59e0b';
$difficultyText = 'Medium';
} elseif ($level == 'hard') {
$difficultyColor = '#ef4444';
$difficultyText = 'Hard';
} else {
$difficultyColor = '#9ca3af';
$difficultyText = 'Unknown';
}
$startTime = !empty($question['start_time']) ? date('d M Y, h:i A', strtotime($question['start_time'])) : 'N/A';
$endTime = !empty($question['end_time']) ? date('d M Y, h:i A', strtotime($question['end_time'])) : 'N/A';
$solvedDate = !empty($question['solved_date']) ? date('d M Y', strtotime($question['solved_date'])) : 'N/A';
@endphp
| {{ $index + 1 }} |
@if($questionDetail)
{{ $questionDetail->title }}
@else
Question #{{ $question['question_id'] ?? '' }}
@endif
|
{{ $difficultyText }}
|
{{ $startTime }} |
{{ $endTime }} |
{{ $timeTaken }} |
@if($marks !== 'N/A')
{{ $marks }}
@else
{{ $marks }}
@endif
|
{{ $solvedDate }} |
@endforeach
@else
You haven't attempted any coding questions for this topic yet.
@endif