From 7608d9bae3167ad838d5421bebb58946347b0e98 Mon Sep 17 00:00:00 2001 From: Maximilian Haye Date: Mon, 14 Oct 2024 18:41:10 +0200 Subject: [PATCH] fix: scoring state is now optional Also remove subquestion classification for now, as it isn't used yet and has changed substantially. --- classes/api/attempt_scored.php | 11 ++--- classes/api/classified_response.php | 64 ----------------------------- 2 files changed, 4 insertions(+), 71 deletions(-) delete mode 100644 classes/api/classified_response.php diff --git a/classes/api/attempt_scored.php b/classes/api/attempt_scored.php index 9c9ad8ef..ced80a7e 100644 --- a/classes/api/attempt_scored.php +++ b/classes/api/attempt_scored.php @@ -30,8 +30,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class attempt_scored extends attempt { - /** @var string */ - public string $scoringstate; + /** @var string|null */ + public ?string $scoringstate; /** @var string */ public string $scoringcode; @@ -39,18 +39,15 @@ class attempt_scored extends attempt { /** @var float|null */ public ?float $score = null; - /** @var classified_response[]|null */ - public ?array $classification = null; - /** * Initializes a new instance. * * @param int $variant * @param attempt_ui $ui - * @param string $scoringstate * @param string $scoringcode + * @param string|null $scoringstate */ - public function __construct(int $variant, attempt_ui $ui, string $scoringstate, string $scoringcode) { + public function __construct(int $variant, attempt_ui $ui, string $scoringcode, ?string $scoringstate = null) { parent::__construct($variant, $ui); $this->scoringstate = $scoringstate; diff --git a/classes/api/classified_response.php b/classes/api/classified_response.php deleted file mode 100644 index daad8892..00000000 --- a/classes/api/classified_response.php +++ /dev/null @@ -1,64 +0,0 @@ -. - -namespace qtype_questionpy\api; - -use qtype_questionpy\array_converter\array_converter; -use qtype_questionpy\array_converter\converter_config; - -defined('MOODLE_INTERNAL') || die; - -/** - * See {@see \question_type::get_possible_responses()} and {@see \question_with_responses::classify_response()}. - * - * @package qtype_questionpy - * @author Maximilian Haye - * @copyright 2023 TU Berlin, innoCampus {@link https://www.questionpy.org} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class classified_response { - /** @var string */ - public string $subquestionid; - - /** @var string */ - public string $responseclass; - - /** @var string */ - public string $response; - - /** @var float */ - public float $score; - - /** - * Initializes a new instance. - * - * @param string $subquestionid - * @param string $responseclass - * @param string $response - * @param float $score - */ - public function __construct(string $subquestionid, string $responseclass, string $response, float $score) { - $this->subquestionid = $subquestionid; - $this->responseclass = $responseclass; - $this->response = $response; - $this->score = $score; - } -} - -array_converter::configure(attempt_scored::class, function (converter_config $config) { - $config->rename("subquestionid", "subquestion_id") - ->rename("responseclass", "response_class"); -});