@foreach ($grouped as $label => $data)
@php
$totalResponses = count($data['rows']);
$avgScore = 0;
$questionCount = 0;
foreach ($data['likertAverages'] as $avg) {
if ($avg !== null) {
$avgScore += $avg;
$questionCount++;
}
}
$avgScore = $questionCount > 0 ? $avgScore / $questionCount : 0;
$scoreColor = $avgScore >= 4 ? 'green' : ($avgScore >= 3 ? 'yellow' : 'red');
$scoreGradient = $avgScore >= 4 ? 'from-green-500 to-green-600' : ($avgScore >= 3 ? 'from-yellow-500 to-yellow-600' : 'from-red-500 to-red-600');
@endphp
{{ number_format($avgScore, 1) }}
Session {{ $label }}
{{ $totalResponses }} responses
@if($avgScore >= 4)
Excellent
@elseif($avgScore >= 3)
Good
@else
Needs Improvement
@endif
Session {{ $label }}
{{ $comment['text'] }}