diff --git a/README.md b/README.md
index 9a56251..dd6f8c5 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.20.0).
+W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.21.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 d7c0227..c5e2eb1 100644
--- a/administrator/components/com_testquestions/language/en-GB/com_testquestions.ini
+++ b/administrator/components/com_testquestions/language/en-GB/com_testquestions.ini
@@ -67,6 +67,7 @@ COM_TESTQUESTIONS_RESULT_PREVIEW="Podgląd zapisanego testu"
COM_TESTQUESTIONS_RESULT_NOT_FOUND="Nie znaleziono zapisanego testu."
COM_TESTQUESTIONS_RESULT_PARTICIPANT="Użytkownik"
COM_TESTQUESTIONS_RESULT_SCORE="Wynik"
+COM_TESTQUESTIONS_RESULT_POINTS_BEFORE_AFTER="Punkty przed / po korekcie"
COM_TESTQUESTIONS_RESULT_DATE="Data zakończenia"
COM_TESTQUESTIONS_RESULT_ANSWERS="Odpowiedzi"
COM_TESTQUESTIONS_RESULT_EXECUTION_TIME="Czas wykonania"
diff --git a/administrator/components/com_testquestions/sql/install.mysql.utf8mb4.sql b/administrator/components/com_testquestions/sql/install.mysql.utf8mb4.sql
index cc6e9ec..93122fc 100644
--- a/administrator/components/com_testquestions/sql/install.mysql.utf8mb4.sql
+++ b/administrator/components/com_testquestions/sql/install.mysql.utf8mb4.sql
@@ -84,6 +84,8 @@ CREATE TABLE IF NOT EXISTS `#__testquestions_results` (
`correct_count` smallint unsigned NOT NULL DEFAULT 0,
`total_count` smallint unsigned NOT NULL DEFAULT 0,
`percentage` decimal(5,2) NOT NULL DEFAULT 0.00,
+ `points_before` int unsigned NOT NULL DEFAULT 0,
+ `points_after` int unsigned NOT NULL DEFAULT 0,
`answers` longtext NULL,
`created` datetime NOT NULL,
`created_by` int unsigned NOT NULL DEFAULT 0,
diff --git a/administrator/components/com_testquestions/sql/updates/mysql/1.21.0.sql b/administrator/components/com_testquestions/sql/updates/mysql/1.21.0.sql
new file mode 100644
index 0000000..dc271f6
--- /dev/null
+++ b/administrator/components/com_testquestions/sql/updates/mysql/1.21.0.sql
@@ -0,0 +1,8 @@
+ALTER TABLE `#__testquestions_results`
+ ADD COLUMN `points_before` int unsigned NOT NULL DEFAULT 0 AFTER `percentage`,
+ ADD COLUMN `points_after` int unsigned NOT NULL DEFAULT 0 AFTER `points_before`;
+
+UPDATE `#__testquestions_results`
+SET `points_before` = `correct_count`,
+ `points_after` = `correct_count`
+WHERE `points_before` = 0 AND `points_after` = 0;
diff --git a/administrator/components/com_testquestions/src/Model/ResultModel.php b/administrator/components/com_testquestions/src/Model/ResultModel.php
index 0be425b..f3bd044 100644
--- a/administrator/components/com_testquestions/src/Model/ResultModel.php
+++ b/administrator/components/com_testquestions/src/Model/ResultModel.php
@@ -57,10 +57,16 @@ class ResultModel extends BaseDatabaseModel
}
unset($answer);
+ $pointsAfter = 0;
+ foreach ($item->answers as $answer) {
+ $pointsAfter += (int) ($answer['awarded_points'] ?? 0);
+ }
+
$db = Factory::getContainer()->get('DatabaseDriver');
$row = (object) [
'id' => $id,
'answers' => json_encode($item->answers, JSON_UNESCAPED_UNICODE),
+ 'points_after' => $pointsAfter,
];
return (bool) $db->updateObject('#__testquestions_results', $row, 'id');
diff --git a/administrator/components/com_testquestions/tmpl/results/default.php b/administrator/components/com_testquestions/tmpl/results/default.php
index 6544e0b..dc3f52f 100644
--- a/administrator/components/com_testquestions/tmpl/results/default.php
+++ b/administrator/components/com_testquestions/tmpl/results/default.php
@@ -16,7 +16,7 @@ use Joomla\CMS\Router\Route;
@@ -25,7 +25,7 @@ use Joomla\CMS\Router\Route;
-
+