Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KNIGHT
Asyst Moodle Plugin
Commits
dc200290
Commit
dc200290
authored
Nov 20, 2024
by
Artem Baranovskyi
Browse files
Final commit.
parent
c884c12b
Changes
3
Show whitespace changes
Inline
Side-by-side
classes/db/quizquery.php
deleted
100755 → 0
View file @
c884c12b
<?php
// This file is part of Moodle - https://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <https://www.gnu.org/licenses/>.
/**
* The plugin uses the ASYST grading tool <https://transfer.hft-stuttgart.de/gitlab/ulrike.pado/ASYST>
* modified to work as a web endpoint.
*
* @package local_asystgrade
* @copyright 2024 Artem Baranovskyi <artem.baranovsky1980@gmail.com>
* @copyright based on work by 2023 Ulrike Padó <ulrike.pado@hft-stuttgart.de>,
* @copyright Yunus Eryilmaz & Larissa Kirschner <https://link.springer.com/article/10.1007/s40593-023-00383-w>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace
local_asystgrade\db
;
use
dml_exception
;
use
moodle_database
;
use
moodle_recordset
;
use
stdClass
;
/**
* Class quizquery handles some SQL queries to fetch data about Quiz
*/
class
quizquery
implements
quizquery_interface
{
/**
* @var moodle_database $db $DB Holds Moodle Database connection
*/
private
moodle_database
$db
;
/**
* Setting DB connection as a class property
*/
public
function
__construct
()
{
global
$DB
;
$this
->
db
=
$DB
;
}
/**
* Function fetches set of question_attempt records
*
* @param int $qid
* @param int $slot
* @return moodle_recordset
* @throws dml_exception
*/
public
function
get_question_attempts
(
int
$qid
,
int
$slot
):
moodle_recordset
{
return
$this
->
db
->
get_recordset
(
'question_attempts'
,
[
'questionid'
=>
$qid
,
'slot'
=>
$slot
],
''
,
'*'
);
}
/**
* Function fetches reference_answer
*
* @param int $qid
* @return stdClass
* @throws dml_exception
*/
public
function
get_reference_answer
(
int
$qid
):
stdClass
{
return
$this
->
db
->
get_record
(
'qtype_essay_options'
,
[
'questionid'
=>
$qid
],
'*'
,
MUST_EXIST
)
->
graderinfo
;
}
/**
* Function fetches set of question_attempt_steps records
*
* @param int $questionAttemptId
* @return moodle_recordset
* @throws dml_exception
*/
public
function
get_attempt_steps
(
int
$questionattemptid
):
moodle_recordset
{
return
$this
->
db
->
get_recordset
(
'question_attempt_steps'
,
[
'questionattemptid'
=>
$questionattemptid
],
''
,
'*'
);
}
/**
* Function fetches reference_answer
*
* @param int $attemptStepId
* @return stdClass
* @throws dml_exception
*/
public
function
get_student_answer
(
int
$attemptstepid
):
stdClass
{
return
$this
->
db
->
get_record
(
'question_attempt_step_data'
,
[
'attemptstepid'
=>
$attemptstepid
,
'name'
=>
'answer'
],
'*'
,
MUST_EXIST
)
->
value
;
}
}
classes/db/quizquery_interface.php
deleted
100755 → 0
View file @
c884c12b
<?php
// This file is part of Moodle - https://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <https://www.gnu.org/licenses/>.
/**
* The plugin uses the ASYST grading tool <https://transfer.hft-stuttgart.de/gitlab/ulrike.pado/ASYST>
* modified to work as a web endpoint.
*
* @package local_asystgrade
* @copyright 2024 Artem Baranovskyi <artem.baranovsky1980@gmail.com>
* @copyright based on work by 2023 Ulrike Padó <ulrike.pado@hft-stuttgart.de>,
* @copyright Yunus Eryilmaz & Larissa Kirschner <https://link.springer.com/article/10.1007/s40593-023-00383-w>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace
local_asystgrade\db
;
/**
* Interface for executing queries related to quiz attempts.
*/
interface
quizquery_interface
{
/**
* Get question attempts for a given question ID and slot.
*
* @param int $qid The question ID.
* @param int $slot The question slot.
* @return moodle_recordset A moodle_recordset of question attempts.
*/
public
function
get_question_attempts
(
int
$qid
,
int
$slot
):
moodle_recordset
;
/**
* Get the reference answer for a given question ID.
*
* @param int $qid The question ID.
* @return stdClass The reference answer.
*/
public
function
get_reference_answer
(
int
$qid
):
stdClass
;
/**
* Get the attempt steps for a given question attempt ID.
*
* @param int $questionAttemptId The question attempt ID.
* @return moodle_recordset A moodle_recordset of attempt steps.
*/
public
function
get_attempt_steps
(
int
$questionattemptid
):
moodle_recordset
;
/**
* Get the student answer for a given attempt step ID.
*
* @param int $attemptStepId The attempt step ID.
* @return stdClass The student answer.
*/
public
function
get_student_answer
(
int
$attemptstepid
):
stdClass
;
}
readme.md
View file @
dc200290
...
@@ -70,14 +70,6 @@ class local_asystgrade_lib {
...
@@ -70,14 +70,6 @@ class local_asystgrade_lib {
+string generate_script(array grades, array inputNames, float maxmark)
+string generate_script(array grades, array inputNames, float maxmark)
}
}
class quizquery {
+get_question_attempts($qid, $slot)
+get_reference_answer($qid)
+get_attempt_steps($question_attempt_id)
+get_student_answer($attemptstepid)
+bool gradesExist(int quizid, int userid)
}
class client {
class client {
+send_data(array $data): bool|string
+send_data(array $data): bool|string
+getInstance(string $endpoint, http_client_interface $httpClient): client
+getInstance(string $endpoint, http_client_interface $httpClient): client
...
@@ -98,18 +90,11 @@ class provider {
...
@@ -98,18 +90,11 @@ class provider {
+string get_reason()
+string get_reason()
}
}
class DB {
}
local_asystgrade_lib <--> quizquery : interacts with
local_asystgrade_lib --> client : sends data to
local_asystgrade_lib --> client : sends data to
local_asystgrade_lib <-- client : get response from
local_asystgrade_lib <-- client : get response from
client --> http_client_interface : implements
client --> http_client_interface : implements
client --> http_client : uses
client --> http_client : uses
http_client_interface <|-- http_client : implements
http_client_interface <|-- http_client : implements
quizquery --> quizquery_interface : implements
quizquery --> DB : uses
provider --> core_privacy_local_metadata_null_provider : implements
provider --> core_privacy_local_metadata_null_provider : implements
quiz_api_test --> client : sends data to
quiz_api_test --> client : sends data to
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment