@extends('layouts.gamification')
@section('title', __('ЕНТ'))
@section('gami-active', 'ent')
{{--
The student's own ЕНТ sittings — StudentCabinetController::ent(), data
from App\Services\EntResults (the same numbers the admin profile card
shows). $ent['attempts'] is newest first.
--}}
@php
$attempts = $ent['attempts'];
$tone = fn (?float $value, float $max) => $value === null || $max <= 0 ? 'cab-dim'
: ($value / $max >= 0.7 ? 'cab-good' : ($value / $max >= 0.4 ? 'cab-mid' : 'cab-low'));
$signed = fn (?float $d) => $d === null ? '—' : ($d > 0 ? '+' : '').rtrim(rtrim(number_format($d, 1, '.', ''), '0'), '.');
$num = fn (float $v) => rtrim(rtrim(number_format($v, 1, '.', ''), '0'), '.');
// Progress line, oldest → newest, scaled to the best of (highest total,
// highest sitting maximum) so a full score touches the top.
$chart = array_reverse($attempts);
$target = $goal === null ? null : (float) $goal->target_score;
$chartMax = max([1.0, $target ?? 0.0, ...array_map(fn ($a) => max($a['total'], $a['max_total']), $chart)]);
$w = 600; $h = 120; $pad = 12;
$points = [];
foreach ($chart as $i => $a) {
$x = count($chart) === 1 ? $w / 2 : $pad + $i * ($w - 2 * $pad) / (count($chart) - 1);
$y = $h - $pad - ($a['total'] / $chartMax) * ($h - 2 * $pad);
$points[] = ['x' => round($x, 1), 'y' => round($y, 1), 'a' => $a];
}
$targetY = $target === null ? null : round($h - $pad - ($target / $chartMax) * ($h - 2 * $pad), 1);
@endphp
@push('styles')
@endpush
@section('gami-content')
{{-- «Моя цель» (EntGoals, 116): settable before the first sitting too. --}}
{{ __('🎓 Моя цель') }}
@if ($goalProgress !== null)
{{ __('Цель: :n баллов', ['n' => $goalProgress['target']]) }}
@if ($goal->university)
{{ $goal->university }}
@endif
@if ($goalProgress['latest'] === null)
{{ __('Сдай пробный ЕНТ, чтобы увидеть, сколько осталось.') }}
@elseif ($goalProgress['reached'])
{{ __('🎉 Цель достигнута!') }}
@else
{{ __('Осталось :n баллов', ['n' => $num($goalProgress['gap'])]) }}
@endif
@if ($goalProgress['latest'] !== null)
@endif
@if ($goalProgress['weakest'] !== [])
{{ __('Больше всего баллов теряется здесь:') }}
@foreach ($goalProgress['weakest'] as $s)
{{ $s['name'] }} −{{ $num($s['lost']) }}
@endforeach
@endif
@else
{{ __('Поставь цель — сколько баллов ты хочешь набрать на ЕНТ. Мы покажем, сколько осталось и где теряются баллы.') }}
@endif
@if ($attempts === [])
@include('partials._mascot', ['pose' => 'thinking', 'class' => 'ax-mascot--empty'])
{{ __('Результатов ЕНТ пока нет — они появятся здесь, как только преподаватель внесёт баллы пробного теста.') }}
@else
{{ $num($ent['latest']['total']) }}
{{ __('последний результат') }}
{{ $num($ent['best']) }}
{{ __('лучший результат') }}
{{ $signed($ent['delta']) }}
{{ __('к прошлому тесту') }}
{{ $signed($ent['total_delta']) }}
{{ __('с первого теста') }}
@if (count($points) > 1)
{{ __('📈 Динамика') }}
@if ($targetY !== null)
{{ __('цель :n', ['n' => $goalProgress['target']]) }}
@endif
@foreach ($points as $p)
{{ date('d.m.Y', strtotime($p['a']['date'])) }}: {{ $num($p['a']['total']) }}
{{ date('d.m', strtotime($p['a']['date'])) }}
@endforeach
@endif
{{ __('🎯 Пробные тесты') }}
@foreach ($attempts as $attempt)
{{ date('d.m.Y', strtotime($attempt['date'])) }}
@if ($attempt['note'])
{{ $attempt['note'] }}
@endif
@if (isset($sheetsByDate[$attempt['date']]))
{{ __('Разбор ответов') }}
@endif
{{ $num($attempt['total']) }}
@if ($attempt['max_total'] > 0)
/ {{ $num($attempt['max_total']) }}
@endif
@if ($attempt['delta'] !== null)
{{ $signed($attempt['delta']) }}
@endif
@if ($attempt['sections'] !== [])
@foreach ($attempt['sections'] as $section)
@php($cls = $tone($section['score'], $section['max_score']))
{{ $section['name'] }}
{{ $num($section['score']) }}/{{ $num($section['max_score']) }}
@endforeach
@endif
@endforeach
@endif
@endsection