Color AI feedback by awarded points

This commit is contained in:
Wojtek
2026-10-16 21:39:35 +02:00
parent 1c1720e1e1
commit 8e62165a1a
4 changed files with 9 additions and 3 deletions
@@ -0,0 +1 @@
-- Wydanie 1.43.25: kolor oceny AI odzwierciedla poziom uznanych punktów.
@@ -102,7 +102,12 @@ $resolveImageUrl = static function ($path) {
<?php endif; ?>
</div>
<?php if (!empty($answer['ai_feedback'])) : ?>
<div class="alert alert-info mt-3"><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_AI_RESULT'); ?>:</strong><br><?php echo nl2br(htmlspecialchars((string) $answer['ai_feedback'], ENT_QUOTES, 'UTF-8')); ?></div>
<?php
$aiPoints = (int) ($answer['awarded_points'] ?? 0);
$maxPoints = (int) ($question->points ?? 0);
$aiAlertClass = $aiPoints <= 0 ? 'alert-danger' : ($aiPoints >= $maxPoints ? 'alert-success' : 'alert-info');
?>
<div class="alert <?php echo $aiAlertClass; ?> mt-3"><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_AI_RESULT'); ?>:</strong><br><?php echo nl2br(htmlspecialchars((string) $answer['ai_feedback'], ENT_QUOTES, 'UTF-8')); ?></div>
<?php endif; ?>
<?php endif; ?>
<?php if ($question->question_type === 'open' && $hasResponse) : ?>