diff --git a/README.md b/README.md index 0396106..ebea422 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Szkielet komponentu Joomla 6 do gromadzenia pytań testowych. - zegar odliczający czas testu i automatyczne zakończenie po jego upływie, - zapisywanie wyników testów i zaznaczonych odpowiedzi w bazie danych, - podgląd zapisanych testów w panelu administratora, +- zapisywanie i wyświetlanie czasu wykonania testu, - pozycję menu „Arkusz egzaminacyjny” z opcjonalnym symbolem arkusza, - listę wyboru dostępnych symboli arkuszy na stronie klienckiej, - możliwość rozwiązania arkusza i wyświetlenia wyniku oraz odpowiedzi poprawnych i zaznaczonych, @@ -29,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.18.1). +W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.19.0). Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**. diff --git a/administrator/components/com_testquestions/language/en-GB/com_testquestions.ini b/administrator/components/com_testquestions/language/en-GB/com_testquestions.ini index b947e9a..20d4bda 100644 --- a/administrator/components/com_testquestions/language/en-GB/com_testquestions.ini +++ b/administrator/components/com_testquestions/language/en-GB/com_testquestions.ini @@ -69,6 +69,7 @@ COM_TESTQUESTIONS_RESULT_PARTICIPANT="Użytkownik" COM_TESTQUESTIONS_RESULT_SCORE="Wynik" COM_TESTQUESTIONS_RESULT_DATE="Data zakończenia" COM_TESTQUESTIONS_RESULT_ANSWERS="Odpowiedzi" +COM_TESTQUESTIONS_RESULT_EXECUTION_TIME="Czas wykonania" COM_TESTQUESTIONS_RESULTS_SEARCH="Szukaj po użytkowniku lub zestawie..." COM_TESTQUESTIONS_YOUR_ANSWER="Twoja odpowiedź" COM_TESTQUESTIONS_SELECTED_ANSWER="Zaznaczona odpowiedź" diff --git a/administrator/components/com_testquestions/sql/install.mysql.utf8mb4.sql b/administrator/components/com_testquestions/sql/install.mysql.utf8mb4.sql index 67dfcc0..cc6e9ec 100644 --- a/administrator/components/com_testquestions/sql/install.mysql.utf8mb4.sql +++ b/administrator/components/com_testquestions/sql/install.mysql.utf8mb4.sql @@ -78,6 +78,8 @@ CREATE TABLE IF NOT EXISTS `#__testquestions_results` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `set_id` int unsigned NOT NULL, `participant_name` varchar(255) NOT NULL DEFAULT '', + `started` datetime NULL DEFAULT NULL, + `execution_time` int unsigned NOT NULL DEFAULT 0, `extra_time` smallint unsigned NOT NULL DEFAULT 0, `correct_count` smallint unsigned NOT NULL DEFAULT 0, `total_count` smallint unsigned NOT NULL DEFAULT 0, diff --git a/administrator/components/com_testquestions/sql/updates/mysql/1.19.0.sql b/administrator/components/com_testquestions/sql/updates/mysql/1.19.0.sql new file mode 100644 index 0000000..4a32076 --- /dev/null +++ b/administrator/components/com_testquestions/sql/updates/mysql/1.19.0.sql @@ -0,0 +1,3 @@ +ALTER TABLE `#__testquestions_results` + ADD COLUMN `started` datetime NULL DEFAULT NULL AFTER `participant_name`, + ADD COLUMN `execution_time` int unsigned NOT NULL DEFAULT 0 AFTER `started`; diff --git a/administrator/components/com_testquestions/tmpl/result/default.php b/administrator/components/com_testquestions/tmpl/result/default.php index 34a6f2e..47d9d7b 100644 --- a/administrator/components/com_testquestions/tmpl/result/default.php +++ b/administrator/components/com_testquestions/tmpl/result/default.php @@ -1,12 +1,16 @@
-
-
escape($this->item->participant_name); ?>
+
+
+
escape($this->item->participant_name); ?>
+
escape(($this->item->subject_title ? $this->item->subject_title . ' — ' : '') . $this->item->set_title); ?>
item->correct_count; ?> / item->total_count; ?> (item->percentage, ENT_QUOTES, 'UTF-8'); ?>%)
+
+
item->execution_time / 60); ?>:item->execution_time % 60), 2, '0', STR_PAD_LEFT); ?>

item->answers as $questionId => $answer) : ?> diff --git a/administrator/components/com_testquestions/tmpl/results/default.php b/administrator/components/com_testquestions/tmpl/results/default.php index a46a1be..6544e0b 100644 --- a/administrator/components/com_testquestions/tmpl/results/default.php +++ b/administrator/components/com_testquestions/tmpl/results/default.php @@ -17,6 +17,7 @@ use Joomla\CMS\Router\Route; + @@ -25,6 +26,7 @@ use Joomla\CMS\Router\Route; escape($item->participant_name); ?> escape(($item->subject_title ? $item->subject_title . ' — ' : '') . $item->set_title); ?> correct_count; ?> / total_count; ?> (percentage, ENT_QUOTES, 'UTF-8'); ?>%) + execution_time / 60); ?>:execution_time % 60), 2, '0', STR_PAD_LEFT); ?> created, 'Y-m-d H:i'); ?> diff --git a/com_testquestions.xml b/com_testquestions.xml index 04a1f72..769d015 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.18.1 + 1.19.0 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 e2bf57b..cc034af 100644 --- a/components/com_testquestions/src/Model/SetModel.php +++ b/components/com_testquestions/src/Model/SetModel.php @@ -71,7 +71,7 @@ class SetModel extends BaseDatabaseModel )->loadObjectList(); } - public function saveResult(string $participantName, int $extraTime, array $result): bool + public function saveResult(string $participantName, int $extraTime, int $startedAt, array $result): bool { $db = Factory::getContainer()->get('DatabaseDriver'); $setId = $this->getSetId(); @@ -84,6 +84,8 @@ class SetModel extends BaseDatabaseModel $row = (object) [ 'set_id' => $setId, 'participant_name' => trim($participantName), + 'started' => $startedAt > 0 ? gmdate('Y-m-d H:i:s', $startedAt) : null, + 'execution_time' => $startedAt > 0 ? max(0, time() - $startedAt) : 0, 'extra_time' => max(0, $extraTime), 'correct_count' => (int) ($result['correct'] ?? 0), 'total_count' => (int) ($result['total'] ?? 0), diff --git a/components/com_testquestions/src/View/Set/HtmlView.php b/components/com_testquestions/src/View/Set/HtmlView.php index 37727b0..215a30a 100644 --- a/components/com_testquestions/src/View/Set/HtmlView.php +++ b/components/com_testquestions/src/View/Set/HtmlView.php @@ -34,6 +34,7 @@ class HtmlView extends BaseHtmlView $this->getModel()->saveResult( $input->post->getString('participant_name', ''), $input->post->getInt('extra_time', 0), + $input->post->getInt('test_started_at', 0), $this->results ); } diff --git a/components/com_testquestions/tmpl/set/default.php b/components/com_testquestions/tmpl/set/default.php index 52b1f38..25b77b9 100644 --- a/components/com_testquestions/tmpl/set/default.php +++ b/components/com_testquestions/tmpl/set/default.php @@ -31,6 +31,7 @@ use Joomla\CMS\Factory;
+ started) : ?> @@ -96,6 +97,7 @@ use Joomla\CMS\Factory; + results) : ?>