diff --git a/README.md b/README.md index dd6f8c5..ffbfcc6 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.21.0). +W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.22.0). Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**. diff --git a/administrator/components/com_testquestions/sql/updates/mysql/1.22.0.sql b/administrator/components/com_testquestions/sql/updates/mysql/1.22.0.sql new file mode 100644 index 0000000..5131c21 --- /dev/null +++ b/administrator/components/com_testquestions/sql/updates/mysql/1.22.0.sql @@ -0,0 +1 @@ +-- Corrected points are calculated as automatic points plus manually awarded correction points. diff --git a/administrator/components/com_testquestions/src/Model/ResultModel.php b/administrator/components/com_testquestions/src/Model/ResultModel.php index f3bd044..45c5622 100644 --- a/administrator/components/com_testquestions/src/Model/ResultModel.php +++ b/administrator/components/com_testquestions/src/Model/ResultModel.php @@ -57,16 +57,16 @@ class ResultModel extends BaseDatabaseModel } unset($answer); - $pointsAfter = 0; + $correctionPoints = 0; foreach ($item->answers as $answer) { - $pointsAfter += (int) ($answer['awarded_points'] ?? 0); + $correctionPoints += (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, + 'points_after' => (int) $item->points_before + $correctionPoints, ]; return (bool) $db->updateObject('#__testquestions_results', $row, 'id'); diff --git a/administrator/components/com_testquestions/tmpl/result/default.php b/administrator/components/com_testquestions/tmpl/result/default.php index 269ffe5..999a577 100644 --- a/administrator/components/com_testquestions/tmpl/result/default.php +++ b/administrator/components/com_testquestions/tmpl/result/default.php @@ -11,6 +11,8 @@