Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2bc1b30704 | ||
|
|
c9ba3df1f3 |
@@ -30,6 +30,6 @@ Szkielet komponentu Joomla 6 do gromadzenia pytań testowych.
|
|||||||
|
|
||||||
## Instalacja
|
## Instalacja
|
||||||
|
|
||||||
W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.43.32).
|
W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.43.34).
|
||||||
|
|
||||||
Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**.
|
Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**.
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ COM_TESTQUESTIONS_RESULTS_AI_TOKENS_TOTAL="Łączne wykorzystanie tokenów w wyn
|
|||||||
COM_TESTQUESTIONS_RESULT_SCORE="Wynik"
|
COM_TESTQUESTIONS_RESULT_SCORE="Wynik"
|
||||||
COM_TESTQUESTIONS_RESULT_POINTS_BEFORE_AFTER="Punkty przed / po korekcie"
|
COM_TESTQUESTIONS_RESULT_POINTS_BEFORE_AFTER="Punkty przed / po korekcie"
|
||||||
COM_TESTQUESTIONS_RESULT_GRADE="Ocena"
|
COM_TESTQUESTIONS_RESULT_GRADE="Ocena"
|
||||||
|
COM_TESTQUESTIONS_RESULT_NOT_ASSESSED="Nie sprawdzono"
|
||||||
COM_TESTQUESTIONS_RESULT_DATE="Data zakończenia"
|
COM_TESTQUESTIONS_RESULT_DATE="Data zakończenia"
|
||||||
COM_TESTQUESTIONS_RESULT_ANSWERS="Odpowiedzi"
|
COM_TESTQUESTIONS_RESULT_ANSWERS="Odpowiedzi"
|
||||||
COM_TESTQUESTIONS_RESULT_EXECUTION_TIME="Czas wykonania"
|
COM_TESTQUESTIONS_RESULT_EXECUTION_TIME="Czas wykonania"
|
||||||
@@ -149,6 +150,7 @@ COM_TESTQUESTIONS_YOUR_ANSWER="Twoja odpowiedź"
|
|||||||
COM_TESTQUESTIONS_SELECTED_ANSWER="Zaznaczona odpowiedź"
|
COM_TESTQUESTIONS_SELECTED_ANSWER="Zaznaczona odpowiedź"
|
||||||
COM_TESTQUESTIONS_ANSWER_CORRECT="Poprawna odpowiedź"
|
COM_TESTQUESTIONS_ANSWER_CORRECT="Poprawna odpowiedź"
|
||||||
COM_TESTQUESTIONS_ANSWER_INCORRECT="Niepoprawna odpowiedź"
|
COM_TESTQUESTIONS_ANSWER_INCORRECT="Niepoprawna odpowiedź"
|
||||||
|
COM_TESTQUESTIONS_ANSWER_PARTIALLY_CORRECT="Odpowiedź częściowo poprawna"
|
||||||
COM_TESTQUESTIONS_CORRECT_PATTERN="Wzorzec poprawnej odpowiedzi"
|
COM_TESTQUESTIONS_CORRECT_PATTERN="Wzorzec poprawnej odpowiedzi"
|
||||||
COM_TESTQUESTIONS_SUBJECT="Przedmiot"
|
COM_TESTQUESTIONS_SUBJECT="Przedmiot"
|
||||||
COM_TESTQUESTIONS_SUBJECT_TITLE="Nazwa przedmiotu"
|
COM_TESTQUESTIONS_SUBJECT_TITLE="Nazwa przedmiotu"
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
-- Brak zmian w schemacie bazy danych w wersji 1.43.33.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
-- Brak zmian w schemacie bazy danych w wersji 1.43.34.
|
||||||
@@ -14,6 +14,7 @@ class ResultsModel extends ListModel
|
|||||||
$items = parent::getItems();
|
$items = parent::getItems();
|
||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
|
$item->has_assessment = false;
|
||||||
$item->ai_input_tokens = 0;
|
$item->ai_input_tokens = 0;
|
||||||
$item->ai_output_tokens = 0;
|
$item->ai_output_tokens = 0;
|
||||||
$item->ai_total_tokens = 0;
|
$item->ai_total_tokens = 0;
|
||||||
@@ -30,6 +31,11 @@ class ResultsModel extends ListModel
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Manual assessment and AI both save awarded_points in the answer JSON.
|
||||||
|
if (array_key_exists('awarded_points', $answer)) {
|
||||||
|
$item->has_assessment = true;
|
||||||
|
}
|
||||||
|
|
||||||
$usages = $answer['ai_usage_history'] ?? (isset($answer['ai_usage']) ? [$answer['ai_usage']] : []);
|
$usages = $answer['ai_usage_history'] ?? (isset($answer['ai_usage']) ? [$answer['ai_usage']] : []);
|
||||||
if (!is_array($usages)) {
|
if (!is_array($usages)) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -77,6 +77,16 @@ $resolveImageUrl = static function ($path) {
|
|||||||
<?php foreach ($this->item->answers as $questionId => $answer) : ?>
|
<?php foreach ($this->item->answers as $questionId => $answer) : ?>
|
||||||
<?php $question = $this->item->questions[(int) $questionId] ?? null; if (!$question) continue; ?>
|
<?php $question = $this->item->questions[(int) $questionId] ?? null; if (!$question) continue; ?>
|
||||||
<?php $hasResponse = trim((string) ($answer['selected'] ?? '')) !== ''; ?>
|
<?php $hasResponse = trim((string) ($answer['selected'] ?? '')) !== ''; ?>
|
||||||
|
<?php
|
||||||
|
$answerStatusCorrect = !empty($answer['correct']);
|
||||||
|
$answerStatusPartial = false;
|
||||||
|
if ($question->question_type === 'open' && array_key_exists('awarded_points', $answer)) {
|
||||||
|
$awardedPoints = (int) $answer['awarded_points'];
|
||||||
|
$maximumPoints = (int) ($question->points ?? 0);
|
||||||
|
$answerStatusCorrect = $awardedPoints > 0 && $awardedPoints >= $maximumPoints;
|
||||||
|
$answerStatusPartial = $awardedPoints > 0 && !$answerStatusCorrect;
|
||||||
|
}
|
||||||
|
?>
|
||||||
<article class="mb-4 border rounded p-3">
|
<article class="mb-4 border rounded p-3">
|
||||||
<div class="mb-2"><?php echo $question->question; ?></div>
|
<div class="mb-2"><?php echo $question->question; ?></div>
|
||||||
<?php if (!empty($question->image)) : ?><div class="mb-3"><img src="<?php echo htmlspecialchars($resolveImageUrl($question->image), ENT_QUOTES, 'UTF-8'); ?>" alt="" loading="lazy" style="max-width: 100%; height: auto;"></div><?php endif; ?>
|
<?php if (!empty($question->image)) : ?><div class="mb-3"><img src="<?php echo htmlspecialchars($resolveImageUrl($question->image), ENT_QUOTES, 'UTF-8'); ?>" alt="" loading="lazy" style="max-width: 100%; height: auto;"></div><?php endif; ?>
|
||||||
@@ -86,7 +96,7 @@ $resolveImageUrl = static function ($path) {
|
|||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<div><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_SELECTED_ANSWER'); ?>:</strong> <?php echo $answer['selected'] ? chr(64 + (int) $answer['selected']) : '—'; ?></div>
|
<div><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_SELECTED_ANSWER'); ?>:</strong> <?php echo $answer['selected'] ? chr(64 + (int) $answer['selected']) : '—'; ?></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="mt-2 <?php echo !empty($answer['correct']) ? 'text-success' : 'text-danger'; ?>"><?php echo !empty($answer['correct']) ? '✓ ' . \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_ANSWER_CORRECT') : '✗ ' . \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_ANSWER_INCORRECT'); ?></div>
|
<div class="mt-2 <?php echo $answerStatusCorrect ? 'text-success' : ($answerStatusPartial ? 'text-warning' : 'text-danger'); ?>"><?php echo $answerStatusCorrect ? '✓ ' . \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_ANSWER_CORRECT') : ($answerStatusPartial ? '◐ ' . \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_ANSWER_PARTIALLY_CORRECT') : '✗ ' . \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_ANSWER_INCORRECT')); ?></div>
|
||||||
<?php if (empty($answer['correct'])) : ?>
|
<?php if (empty($answer['correct'])) : ?>
|
||||||
<?php if ($question->question_type === 'open' && $hasResponse) : ?>
|
<?php if ($question->question_type === 'open' && $hasResponse) : ?>
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
|
|||||||
@@ -84,12 +84,14 @@ HTMLHelper::_('behavior.multiselect');
|
|||||||
<?php $pointsTotal = (int) $item->points_total ?: (int) $item->total_count; ?>
|
<?php $pointsTotal = (int) $item->points_total ?: (int) $item->total_count; ?>
|
||||||
<?php $pointsBeforePercentage = $pointsTotal ? round(((int) $item->points_before / $pointsTotal) * 100, 2) : 0; ?>
|
<?php $pointsBeforePercentage = $pointsTotal ? round(((int) $item->points_before / $pointsTotal) * 100, 2) : 0; ?>
|
||||||
<?php $pointsAfterPercentage = $pointsTotal ? round(((int) $item->points_after / $pointsTotal) * 100, 2) : 0; ?>
|
<?php $pointsAfterPercentage = $pointsTotal ? round(((int) $item->points_after / $pointsTotal) * 100, 2) : 0; ?>
|
||||||
|
<?php if ($item->has_assessment) : ?>
|
||||||
<?php $grade = 'NDST'; ?>
|
<?php $grade = 'NDST'; ?>
|
||||||
<?php foreach ([['CEL', 100], ['BDB', 90], ['BDB-', 80], ['DB+', 75], ['DB', 70], ['DB-', 65], ['DST+', 60], ['DST', 55], ['DST-', 50], ['DOP+', 45], ['DOP', 40], ['DOP-', 35], ['NDST+', 30], ['NDST', 0]] as $gradeScale) : ?>
|
<?php foreach ([['CEL', 100], ['BDB', 90], ['BDB-', 80], ['DB+', 75], ['DB', 70], ['DB-', 65], ['DST+', 60], ['DST', 55], ['DST-', 50], ['DOP+', 45], ['DOP', 40], ['DOP-', 35], ['NDST+', 30], ['NDST', 0]] as $gradeScale) : ?>
|
||||||
<?php if ($pointsAfterPercentage >= $gradeScale[1]) { $grade = $gradeScale[0]; break; } ?>
|
<?php if ($pointsAfterPercentage >= $gradeScale[1]) { $grade = $gradeScale[0]; break; } ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<td><?php echo (int) $item->points_before; ?> (<?php echo $pointsBeforePercentage; ?>%) / <?php echo (int) $item->points_after; ?> (<?php echo $pointsAfterPercentage; ?>%)</td>
|
<?php endif; ?>
|
||||||
<td><?php echo $this->escape($grade); ?></td>
|
<td><?php echo (int) $item->points_before; ?> (<?php echo $pointsBeforePercentage; ?>%) / <?php if ($item->has_assessment) : ?><?php echo (int) $item->points_after; ?> (<?php echo $pointsAfterPercentage; ?>%)<?php else : ?><span class="text-muted"><?php echo $this->escape(\Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_NOT_ASSESSED')); ?></span><?php endif; ?></td>
|
||||||
|
<td><?php echo $item->has_assessment ? $this->escape($grade) : '<span class="text-muted">' . $this->escape(\Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_NOT_ASSESSED')) . '</span>'; ?></td>
|
||||||
<td><?php echo floor((int) $item->execution_time / 60); ?>:<?php echo str_pad((string) ((int) $item->execution_time % 60), 2, '0', STR_PAD_LEFT); ?></td>
|
<td><?php echo floor((int) $item->execution_time / 60); ?>:<?php echo str_pad((string) ((int) $item->execution_time % 60), 2, '0', STR_PAD_LEFT); ?></td>
|
||||||
<td><?php echo HTMLHelper::_('date', $item->created, 'Y-m-d H:i'); ?></td>
|
<td><?php echo HTMLHelper::_('date', $item->created, 'Y-m-d H:i'); ?></td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<creationDate>2026-10-14</creationDate>
|
<creationDate>2026-10-14</creationDate>
|
||||||
<author>Komponent</author>
|
<author>Komponent</author>
|
||||||
<license>GNU General Public License version 2 or later</license>
|
<license>GNU General Public License version 2 or later</license>
|
||||||
<version>1.43.32</version>
|
<version>1.43.34</version>
|
||||||
<description>COM_TESTQUESTIONS_DESCRIPTION</description>
|
<description>COM_TESTQUESTIONS_DESCRIPTION</description>
|
||||||
<element>com_testquestions</element>
|
<element>com_testquestions</element>
|
||||||
<namespace path="src">Komponent\Component\Testquestions</namespace>
|
<namespace path="src">Komponent\Component\Testquestions</namespace>
|
||||||
|
|||||||
Reference in New Issue
Block a user