diff --git a/README.md b/README.md index ff8fe93..5f37be9 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,6 @@ Szkielet komponentu Joomla 6 do gromadzenia pytań testowych. ## Instalacja -W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.43.19). +W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.43.20). Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**. diff --git a/administrator/components/com_testquestions/sql/updates/mysql/1.43.20.sql b/administrator/components/com_testquestions/sql/updates/mysql/1.43.20.sql new file mode 100644 index 0000000..175a994 --- /dev/null +++ b/administrator/components/com_testquestions/sql/updates/mysql/1.43.20.sql @@ -0,0 +1 @@ +-- Wydanie 1.43.20: czas testu bez ustawionego limitu zestawu jest sumowany z czasów pytań. diff --git a/com_testquestions.xml b/com_testquestions.xml index 6072797..8e9162c 100644 --- a/com_testquestions.xml +++ b/com_testquestions.xml @@ -4,7 +4,7 @@ 2026-10-14 Komponent GNU General Public License version 2 or later - 1.43.19 + 1.43.20 COM_TESTQUESTIONS_DESCRIPTION com_testquestions Komponent\Component\Testquestions diff --git a/components/com_testquestions/src/Model/SetModel.php b/components/com_testquestions/src/Model/SetModel.php index bf5a52b..1e460e4 100644 --- a/components/com_testquestions/src/Model/SetModel.php +++ b/components/com_testquestions/src/Model/SetModel.php @@ -77,7 +77,7 @@ class SetModel extends BaseDatabaseModel } $query = $db->getQuery(true) - ->select(['q.id', 'q.question_type', 'q.question', 'q.answer_a', 'q.answer_b', 'q.answer_c', 'q.answer_d', 'q.answer_open', 'q.correct_answer', 'q.points', 'q.image']) + ->select(['q.id', 'q.question_type', 'q.question', 'q.answer_a', 'q.answer_b', 'q.answer_c', 'q.answer_d', 'q.answer_open', 'q.correct_answer', 'q.points', 'q.image', 'q.time_limit']) ->from($db->quoteName('#__testquestions_set_questions', 'sq')) ->innerJoin($db->quoteName('#__testquestions_questions', 'q') . ' ON q.id = sq.question_id') ->where('sq.set_id = ' . $setId) diff --git a/components/com_testquestions/tmpl/set/default.php b/components/com_testquestions/tmpl/set/default.php index c3d39c7..2ad74c5 100644 --- a/components/com_testquestions/tmpl/set/default.php +++ b/components/com_testquestions/tmpl/set/default.php @@ -5,6 +5,8 @@ defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\Uri\Uri; +$testDurationSeconds = 0; + $resolveImageUrl = static function ($path) { $path = trim((string) $path); @@ -50,16 +52,26 @@ $resolveImageUrl = static function ($path) { set) : ?>
+ getInput()->post->getInt('extra_time', 0); + $baseDurationSeconds = (int) $this->set->duration > 0 + ? (int) $this->set->duration * 60 + : array_sum(array_map(static function ($item) { + return max(0, (int) ($item->time_limit ?? 0)); + }, $this->items)); + $testDurationSeconds = $baseDurationSeconds + ($extraTime * 60); + $durationMinutes = intdiv($testDurationSeconds, 60); + $durationRemainder = $testDurationSeconds % 60; + ?>
set->subject_title) : ?>
set->subject_title, ENT_QUOTES, 'UTF-8'); ?>

set->title, ENT_QUOTES, 'UTF-8'); ?>

- getInput()->post->getInt('extra_time', 0); ?> - set->duration > 0) : ?>
: set->duration + $extraTime; ?> min
+ 0) : ?>
: min 0) : ?> s
set->image) : ?>
set->test_content) : ?>
set->test_content; ?>
- results && ((int) $this->set->duration + $extraTime) > 0) : ?> -
+ results && $testDurationSeconds > 0) : ?> +
-started && !$this->results && ((int) $this->set->duration + $extraTime) > 0) : ?> +started && !$this->results && $testDurationSeconds > 0) : ?>