Commit 2e30eaa7 authored by Artem Baranovskyi's avatar Artem Baranovskyi
Browse files

Few Moodle coding style fixes.

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