ewallah / moodle-availability_relativedate

Relative dates in Moodle
https://moodle.org/plugins/availability_relativedate
GNU General Public License v3.0
8 stars 8 forks source link

SQL Server Compatability #13

Closed advancingdesign closed 3 years ago

advancingdesign commented 3 years ago

I am testing the plugin on our LMS but we are one of the few with a Windows and SQL Server backend. I had to modify the queries in the condition.php to use TOP 1 rather than limit. I'm not sure what is the best fix in this case for global support.

SELECT TOP 1 ue.timestart FROM {user_enrolments} ue JOIN {enrol} e on ue.enrolid = e.id WHERE e.courseid = :courseid AND ue.userid = :userid AND ue.timestart > 0 ORDER by ue.timestart DESC

ewallah commented 3 years ago

Done with tag v3.9.4

ewallah commented 3 years ago

Fixed by using get_record_sql with the IGNORE_MULTIPLE parameter.

THX @advancingdesign for the report.