You need to sign in or sign up before continuing.
Commit 2e30eaa7 authored by Artem Baranovskyi's avatar Artem Baranovskyi
Browse files

Few Moodle coding style fixes.

parent d0b18af8
Showing with 19 additions and 20 deletions
+19 -20
<?php
namespace local_asystgrade\db;
class QuizQuery implements QuizQueryInterface
class quizquery implements quizquery_interface
{
private $db;
......
......@@ -2,7 +2,7 @@
namespace local_asystgrade\db;
interface QuizQueryInterface
interface quizquery_interface
{
public function get_question_attempts($qid, $slot);
......
......@@ -22,7 +22,7 @@
use local_asystgrade\api\client;
use local_asystgrade\api\http_client;
use local_asystgrade\db\QuizQuery;
use local_asystgrade\db\quizquery;
defined('MOODLE_INTERNAL') || die();
......@@ -41,7 +41,7 @@ function local_asystgrade_before_footer()
$slot = optional_param('slot', false, PARAM_INT);
if ($PAGE->url->compare(new moodle_url('/mod/quiz/report.php'), URL_MATCH_BASE) && $slot) {
$quizQuery = new QuizQuery();
$quizQuery = new quizquery();
if ($quizQuery->gradesExist($qid, $slot)) {
error_log('Grades already exist in the database.');
......@@ -113,12 +113,12 @@ function pasteGradedMarks(array $grades, array $inputNames, float $maxmark): voi
/**
* Processes question attempts and answers to prepare for API a data to estimate answers
*
* @param QuizQuery $database
* @param quizquery $database
* @param $question_attempts
* @param $referenceAnswer
* @return array
*/
function prepare_api_data(QuizQuery $database, $question_attempts, $referenceAnswer): array
function prepare_api_data(quizquery $database, $question_attempts, $referenceAnswer): array
{
$studentData = [];
......@@ -189,16 +189,16 @@ function generate_script(array $grades, array $inputNames, float $maxmark) {
/**
* Autoloader registration
*/
spl_autoload_register(function ($classname) {
// Check if the class name starts with our plugin's namespace
if (strpos($classname, 'local_asystgrade\\') === 0) {
// Transforming the Namespace into the Path
$classname = str_replace('local_asystgrade\\', '', $classname);
$classname = str_replace('\\', DIRECTORY_SEPARATOR, $classname);
$filepath = __DIR__ . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . $classname . '.php';
if (file_exists($filepath)) {
require_once($filepath);
}
}
});
//spl_autoload_register(function ($classname) {
// // Check if the class name starts with our plugin's namespace
// if (strpos($classname, 'local_asystgrade\\') === 0) {
// // Transforming the Namespace into the Path
// $classname = str_replace('local_asystgrade\\', '', $classname);
// $classname = str_replace('\\', DIRECTORY_SEPARATOR, $classname);
// $filepath = __DIR__ . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . $classname . '.php';
//
// if (file_exists($filepath)) {
// require_once($filepath);
// }
// }
//});
......@@ -227,7 +227,6 @@ class quiz_api_test extends advanced_testcase
'referenceAnswer' => $referenceAnswer,
'studentAnswers' => $studentAnswers
];
// var_dump($data);
error_log("Data to send to API: " . print_r($data, true));
$response = $apiClient->send_data($data);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment