Moodle 2.0 Attendance module fix for use with PostgreSQL

Here you will find a small fix for the attendance module for moodle 2.0. Some queries have problems if the are executed on our PostgreSQL database. So if you get some “group by” errors you could use the following fix. For the module see here
Change query @row 826

SELECT ue.userid, ue.status, ue.timestart, ue.timeend
                      FROM {user_enrolments} ue
                      JOIN {enrol} e ON e.id = ue.enrolid
                     WHERE ue.userid $usql
                           AND e.status = :estatus
                           AND e.courseid = :courseid
                  GROUP BY ue.userid, ue.status, ue.timestart,ue.timeend

and @row 851

SELECT ue.userid, ue.status, ue.timestart, ue.timeend
                  FROM {user_enrolments} ue
                  JOIN {enrol} e ON e.id = ue.enrolid
                 WHERE ue.userid = :uid
                       AND e.status = :estatus
                       AND e.courseid = :courseid
              GROUP BY ue.userid,ue.status, ue.timestart, ue.timeend

have fun

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.