Use rendered AI feedback in PDF comments
This commit is contained in:
@@ -47,7 +47,8 @@ $resolveImageUrl = static function ($path) {
|
||||
document.querySelectorAll('.result-pdf-comment').forEach(function (commentBlock) {
|
||||
const questionId = commentBlock.dataset.questionId;
|
||||
const manualComment = document.getElementById('result-comment-' + questionId)?.value.trim() || '';
|
||||
const aiComment = commentBlock.dataset.aiComment || '';
|
||||
const visibleAiFeedback = document.querySelector('.ai-feedback-screen[data-question-id="' + questionId + '"] .ai-feedback-text')?.textContent.trim() || '';
|
||||
const aiComment = visibleAiFeedback || commentBlock.dataset.aiComment || '';
|
||||
const output = commentBlock.querySelector('.result-pdf-comment-text');
|
||||
|
||||
if (output) {
|
||||
@@ -172,7 +173,7 @@ $resolveImageUrl = static function ($path) {
|
||||
$maxPoints = (int) ($question->points ?? 0);
|
||||
$aiAlertClass = $aiPoints <= 0 ? 'alert-danger' : ($aiPoints >= $maxPoints ? 'alert-success' : 'alert-info');
|
||||
?>
|
||||
<div class="alert <?php echo $aiAlertClass; ?> mt-3 ai-feedback-screen"><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>
|
||||
<div class="alert <?php echo $aiAlertClass; ?> mt-3 ai-feedback-screen" data-question-id="<?php echo (int) $questionId; ?>"><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_AI_RESULT'); ?>:</strong><br><span class="ai-feedback-text"><?php echo nl2br(htmlspecialchars((string) $answer['ai_feedback'], ENT_QUOTES, 'UTF-8')); ?></span></div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($question->question_type === 'open' && $hasResponse) : ?>
|
||||
|
||||
Reference in New Issue
Block a user