diff --git a/dta.zip b/dta.zip index b35770daf7870b735d46f7150169198a2a38df19..cc6f4c3f06c523eb5039144924d3f51da123844b 100644 Binary files a/dta.zip and b/dta.zip differ diff --git a/dta/db/upgrade.php b/dta/db/upgrade.php index 7ee51ec0098bb3775619ec74728bcf65d33f5f4e..65e64b47ffd5b0bc063936a8a3d6a32cfe83db9d 100644 --- a/dta/db/upgrade.php +++ b/dta/db/upgrade.php @@ -19,6 +19,7 @@ * * @package assignsubmission_dta * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright Gero Lueckemeyer and student project teams */ /** @@ -28,6 +29,6 @@ */ function xmldb_assignsubmission_dta_upgrade($oldversion) { global $CFG; - + // Currently no adjustments necessary for Moodle upgrades. Works without changes since the first MoJEC version. return true; } diff --git a/dta/lang/en/assignsubmission_dta.php b/dta/lang/en/assignsubmission_dta.php index 2b8d945517c06da01894d4c42259012b5efddc6c..54cffa3723068abfd166010e56076303dd369cc5 100644 --- a/dta/lang/en/assignsubmission_dta.php +++ b/dta/lang/en/assignsubmission_dta.php @@ -19,6 +19,7 @@ * * @package assignsubmission_dta * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright Gero Lueckemeyer and student project teams */ // General. diff --git a/dta/lib.php b/dta/lib.php index b412fe9b7b9e31cc56aaa7831434f779484bd8ce..c090bfc9e6b6524bbb50867fdc2d5e9b6e568103 100644 --- a/dta/lib.php +++ b/dta/lib.php @@ -19,6 +19,7 @@ * * @package assignsubmission_dta * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright Gero Lueckemeyer and student project teams */ /** diff --git a/dta/locallib.php b/dta/locallib.php index 1e77341471604dd80365b33b05f176391d26ea49..1e6520363ed32affffc81b88ac928b0e8bdb64bf 100644 --- a/dta/locallib.php +++ b/dta/locallib.php @@ -30,13 +30,21 @@ require_once($CFG->dirroot . '/mod/assign/submission/dta/utils/view.php'); */ class assign_submission_dta extends assign_submission_plugin { - // Broadly used in logic, parametrized for easier change. + /** + * Broadly used in logic, parametrized for easier change. + */ const COMPONENT_NAME = "assignsubmission_dta"; - // Draft file area for dta tests to be uploaded by the teacher. + /** + * Draft file area for dta tests to be uploaded by the teacher. + */ const ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST = "tests_draft_dta"; - // File area for dta tests to be uploaded by the teacher. + /** + * File area for dta tests to be uploaded by the teacher. + */ const ASSIGNSUBMISSION_DTA_FILEAREA_TEST = "tests_dta"; - // File area for dta submission assignment. + /** + * File area for dta submission assignment. + */ const ASSIGNSUBMISSION_DTA_FILEAREA_SUBMISSION = "submissions_dta"; /** @@ -304,7 +312,7 @@ class assign_submission_dta extends assign_submission_plugin { public function view_summary(stdClass $submission, & $showviewlink) { $showviewlink = true; - return ViewSubmissionUtils::generatesummaryhtml( + return view_submission_utils::generatesummaryhtml( $this->assignment->get_instance()->id, $submission->id ); @@ -317,7 +325,7 @@ class assign_submission_dta extends assign_submission_plugin { * @return string detailed results html */ public function view(stdClass $submission) { - return ViewSubmissionUtils::generatedetailhtml( + return view_submission_utils::generatedetailhtml( $this->assignment->get_instance()->id, $submission->id ); diff --git a/dta/models/DtaResult.php b/dta/models/DtaResult.php index b666f51a6b429f8acb9c2eda7a13d97e7cc48752..4ca751eb4d48aa7f1824e49303bb385d2aa08ab4 100644 --- a/dta/models/DtaResult.php +++ b/dta/models/DtaResult.php @@ -16,13 +16,33 @@ defined('MOODLE_INTERNAL') || die(); +/** + * entity class for DTA submission plugin result + * + * @package assignsubmission_dta + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright Gero Lueckemeyer and student project teams + */ class DtaResult { - // Broadly used in logic, parametrized for easier change. + /** + * Broadly used in logic, parametrized for easier change. + */ const COMPONENT_NAME = "assignsubmission_dta"; + /** + * Package name of the test. + */ public $packagename; + + /** + * Unit name of the test. + */ public $classname; + + /** + * Name of the test. + */ public $name; /** @@ -35,16 +55,37 @@ class DtaResult { */ public $state; + /** + * Type of test failure if applicable, "" otherwise. + */ public $failuretype; + + /** + * Reason of test failure if applicable, "" otherwise. + */ public $failurereason; + + /** + * Stack trace of test failure if applicable, "" otherwise. + */ public $stacktrace; + /** + * Column number of compile failure if applicable, "" otherwise. + */ public $columnnumber; + /** + * Line number of compile failure if applicable, "" otherwise. + */ public $linenumber; + /** + * Position of compile failure if applicable, "" otherwise. + */ public $position; /** - * @return name of state like defined + * Returns the name of a state with the given number of display. + * @return name of state as defined */ public static function getstatename(int $state): string { if ($state == 1) { @@ -59,15 +100,40 @@ class DtaResult { } } +/** + * entity class for DTA submission plugin result + * + * @package assignsubmission_dta + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright Gero Lueckemeyer and student project teams + */ class DtaResultSummary { + /** + * Result timestamp for chronological ordering and deletion of previous results. + */ public $timestamp; + + /** + * Global stack trace if applicable, "" otherwise. + */ public $globalstacktrace; + + /** + * Successfully tested competencies according to tests and weights, "" otherwise. + */ public $successfultestcompetencies; + /** + * Overall tested competencies according to tests and weights, "" otherwise. + */ public $overalltestcompetencies; + /** + * List of detail results. + */ public $results; /** + * Decodes the JSON result summary returned by the backend service call into the plugin PHP data structure. * @param string $jsonString jsonString containing DtaResultSummary * @return DtaResultSummary */ @@ -87,6 +153,7 @@ class DtaResultSummary { } /** + * Decodes the array of JSON detail results returned by the backend service call into the plugin PHP data structure. * @param array $jsonArray decoded json array of results array * @return array of DtaResult */ @@ -113,11 +180,17 @@ class DtaResultSummary { return $ret; } + + /** + * Returns the number of detail results attached to the summary. + * @return int count of occurences + */ public function resultcount(): int { return count($this->results); } /** + * Returns the number of detail results with the given state attached to the summary. * @param int $state state ordinal number * @return int count of occurences provided state has */ @@ -131,18 +204,34 @@ class DtaResultSummary { return $num; } + /** + * Returns the number of detail results with compilation errors attached to the summary. + * @return int count of occurences + */ public function compilationerrorcount(): int { return $this->stateoccurencecount(3); } + /** + * Returns the number of detail results with test failures attached to the summary. + * @return int count of occurences + */ public function failedcount(): int { return $this->stateoccurencecount(2); } + /** + * Returns the number of detail results with successful tests attached to the summary. + * @return int count of occurences + */ public function successfulcount(): int { return $this->stateoccurencecount(1); } + /** + * Returns the number of detail results with an unknown result - mostly due to compile errors - attached to the summary. + * @return int count of occurences + */ public function unknowncount(): int { return $this->stateoccurencecount(0); } diff --git a/dta/settings.php b/dta/settings.php index 1dcd60a518042eb19dd94017961f0e78a42f2dcf..fe1071ae451edaea9408c8d23f284e46089ea221 100644 --- a/dta/settings.php +++ b/dta/settings.php @@ -19,6 +19,7 @@ * * @package assignsubmission_dta * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright Gero Lueckemeyer and student project teams */ defined('MOODLE_INTERNAL') || die(); diff --git a/dta/utils/view.php b/dta/utils/view.php index 98af5c3e1d0466d9c5a2c35172bb5e92681b9feb..db3cd77f310147633663bb638690ab6155e5c77d 100644 --- a/dta/utils/view.php +++ b/dta/utils/view.php @@ -14,9 +14,18 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. -class ViewSubmissionUtils { - - // Broadly used in logic, parametrized for easier change. +/** + * utility class for DTA submission plugin result display + * + * @package assignsubmission_dta + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright Gero Lueckemeyer and student project teams + */ +class view_submission_utils { + + /** + * Broadly used in logic, parametrized for easier change. + */ const COMPONENT_NAME = "assignsubmission_dta"; /** @@ -60,16 +69,16 @@ class ViewSubmissionUtils { $overallcompetencies = explode(";", $summary->overalltestcompetencies); $tmp = ""; - for ($index=0, $size=count($showncompetencies); $index<$size; $index++) { - $shown=$showncompetencies[$index]; - $comp=$overallcompetencies[$index]; + for ($index = 0, $size = count($showncompetencies); $index < $size; $index++) { + $shown = $showncompetencies[$index]; + $comp = $overallcompetencies[$index]; // If the competency was actually assessed by the assignment and tests, add a summary entry. if($shown!="0") { $tmp .= get_string("comp" . $index, self::COMPONENT_NAME) . " " . 100*floatval($shown)/floatval($comp) . "% " . "<br />"; } } - $html .= get_string("success_competencies", self::COMPONENT_NAME) . $tmp . "<br />"; + $html .= get_string("success_competencies", self::COMPONENT_NAME) . "<br />" . $tmp . "<br />"; return html_writer::div($html, "dtaSubmissionSummary"); } @@ -223,11 +232,11 @@ class ViewSubmissionUtils { $showncompetencies = explode(";", $summary->successfultestcompetencies); $overallcompetencies = explode(";", $summary->overalltestcompetencies); - for ($index=0, $size=count($overallcompetencies); $index<$size; $index++) { - $comp=$overallcompetencies[$index]; - $shown=$showncompetencies[$index]; + for ($index = 0, $size = count($overallcompetencies); $index < $size; $index++) { + $comp = $overallcompetencies[$index]; + $shown = $showncompetencies[$index]; // If the competency was actually assessed by the assignment and tests, add a row in the table. - if($comp!="0") { + if($comp != "0") { // New copy of base attributes array. $resultrowattributes = $tablerowattributes; $tmp = ""; diff --git a/dta/version.php b/dta/version.php index ddff0ae07e9612d4c0d4e217805445e8ca60ec3f..b7de914023700775b20887a2e06ce73f6e2975e8 100644 --- a/dta/version.php +++ b/dta/version.php @@ -19,6 +19,7 @@ * * @package assignsubmission_dta * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright Gero Lueckemeyer and student project teams */ defined('MOODLE_INTERNAL') || die();