compilatio / moodle-plagiarism_compilatio

Compilatio.net plagiarism plugin for Moodle
4 stars 9 forks source link

Compilatio cause DB errors #91

Closed Badatos closed 1 year ago

Badatos commented 1 year ago

Hello ! there is an error in your code in file "lib.php" at the "compilatio_get_statistics" function causing several "database error" preventing Moodle from displaying some quiz report

The SQL generating the error looks like that:

SELECT COUNT(DISTINCT pcf.id)
        FROM mdl_plagiarism_compilatio_files pcf
        WHERE pcf.cm=$1AND statuscode='XXX'

As you can see, there is no space between $1 and "AND", causing an error

ERROR:  trailing junk after parameter at or near "$1A"
LINE 4:         WHERE pcf.cm=$1AND statuscode='XXX'

This can be easily fixed by adding space in front of every occurence of $countanalyzedsql = $sql . "AND statuscode='" .in your lib.php file.

compilatio commented 1 year ago

Hello, We've just added a space after the cm=? in the first part of the SQL request in plugin version 2.7.0 which we've just released

2 7 0

This should solve the problem, feel free to re-open the issue if it still occurs