Treat placeholder comments as empty in PDF

This commit is contained in:
Wojtek
2026-10-17 13:18:25 +02:00
parent dba7a2511d
commit 175dacf07a
4 changed files with 10 additions and 3 deletions
@@ -0,0 +1 @@
-- Brak zmian w schemacie bazy danych w wersji 1.43.41.
@@ -46,7 +46,10 @@ $resolveImageUrl = static function ($path) {
window.addEventListener('beforeprint', function () {
document.querySelectorAll('.result-pdf-comment').forEach(function (commentBlock) {
const questionId = commentBlock.dataset.questionId;
const manualComment = document.getElementById('result-comment-' + questionId)?.value.trim() || '';
let manualComment = document.getElementById('result-comment-' + questionId)?.value.trim() || '';
if (manualComment === '-' || manualComment === '—') {
manualComment = '';
}
const storedAiFeedback = commentBlock.querySelector('.result-pdf-ai-source')?.textContent.trim() || '';
const visibleAiFeedback = document.querySelector('.ai-feedback-screen[data-question-id="' + questionId + '"] .ai-feedback-text')?.textContent.trim() || '';
const aiComment = storedAiFeedback || visibleAiFeedback;
@@ -133,6 +136,9 @@ $resolveImageUrl = static function ($path) {
$answerStatusPartial = $awardedPoints > 0 && !$answerStatusCorrect;
}
$manualComment = trim((string) ($answer['comment'] ?? ''));
if ($manualComment === '-' || $manualComment === '—') {
$manualComment = '';
}
$aiComment = trim((string) ($answer['ai_feedback'] ?? ''));
$printComment = $manualComment !== '' ? $manualComment : $aiComment;
?>