@extends('layouts.admin') @section('title', 'Test • '.$test->id.' • '.($user->name ?? $user->email)) @section('content')
{{-- Header --}}

Test #{{ $test->id }} — Questions

User: {{ $user->name ?? $user->email }}
Back to User
{{-- Optional summary from test_user pivot --}} @if(!empty($testPivot))
{{ $testPivot->test_completed ? 'Yes' : 'No' }}
Completed
{{ is_null($testPivot->result) ? '—' : number_format($testPivot->result, 2) }}
Result
{{ (int) $testPivot->attempts }}
Attempts
{{ (int) $testPivot->kudos }}
Kudos
@endif {{-- Attempts table --}}
Question Attempts
@php use Illuminate\Support\Facades\Route as RouteFacade; $dateFmt = function($d){ if(!$d) return '—'; try { return \Carbon\Carbon::parse($d)->format('M d, Y H:i'); } catch (\Throwable $e) { return '—'; } }; $routeOr = function(string $name, $paramId, string $fallbackBase) { return RouteFacade::has($name) ? route($name, $paramId) : url($fallbackBase.'/'.$paramId); }; @endphp @forelse($attempts as $q) @php // Linked skill (if present) $skillCell = '—'; if ($q->skill?->id) { $skillUrl = $routeOr('admin.skills.show', $q->skill->id, '/admin/skills'); $skillCell = ''.e($q->skill->skill).''; } // Build per-line linked tracks with their field links $trackLines = []; if ($q->relationLoaded('skill') && $q->skill && $q->skill->relationLoaded('tracks')) { foreach ($q->skill->tracks as $t) { if (!$t) continue; $trackName = $t->track ?? null; if (!$trackName) continue; $trackUrl = $routeOr('admin.tracks.show', $t->id, '/admin/tracks'); $trackLink = ''.e($trackName).''; $fieldChunk = ''; if ($t->relationLoaded('field') && $t->field) { $fieldName = $t->field->field ?? null; if ($fieldName) { $fieldUrl = $routeOr('admin.fields.show', $t->field->id, '/admin/fields'); $fieldChunk = ' '.e($fieldName).' )'; } } $trackLines[] = '
'.$trackLink.$fieldChunk.'
'; } } $tracksCell = $trackLines ? implode('', $trackLines) : '—'; @endphp @empty @endforelse
QID Question Skill Tracks (Field) Answered Correct Attempts Kudos Answered At
{{ $q->id }} {{ \Illuminate\Support\Str::limit(strip_tags($q->question ?? ''), 140) }} {!! $skillCell !!} {!! $tracksCell !!} @if($q->pivot->question_answered) Yes @else No @endif @if($q->pivot->correct) @else @endif {{ (int) $q->pivot->attempts }} {{ (int) $q->pivot->kudos }} {{ $dateFmt($q->pivot->answered_date ?? null) }}
No question attempts found for this test.
Source: question_user where user_id={{ $user->id }} and test_id={{ $test->id }}.
{{-- Scoped styles so other screens are unaffected --}} @endsection