moodleou / moodle-mod_forumng

ForumNG forum module for Moodle
19 stars 20 forks source link

Students can't view participation by date range #35

Closed mfindlayated closed 9 years ago

mfindlayated commented 9 years ago

If you go to ForumNG > Discussion > View participation (as a student)

You see all of the posts that you have contributed to the discussion. However, if you then try to filter that list by enabling the date criteria, and then selecting update, you get the error attached.... screen shot 2014-10-03 at 09 38 13

jason-platts commented 9 years ago

Is it possible to get the stack trace for the database error?

I can't replicate on the latest version of the code on Moodle 2.7 Postgres.

mfindlayated commented 9 years ago

Hi,

It's the current version of the plugin, running on Moodle 2.6.2+, and using a MySQL database. The functionality does work correctly when logged in as a Teacher. Switching on debuging outputs the following error:

Error reading from database

More information about this error

Debug info: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'fp.created >= '1412287200' ORDER BY fd.forumngid' at line 28

SELECT fp.*, u.firstnamephonetic as u_firstnamephonetic,u.lastnamephonetic as u_lastnamephonetic,u.middlename as u_middlename,u.alternatename as u_alternatename,u.firstname as u_firstname,u.lastname as u_lastname,u.id as u_id,u.username as u_username,u.picture as u_picture,u.url as u_url,u.imagealt as u_imagealt,u.idnumber as u_idnumber,u.email as u_email, eu.firstnamephonetic as eu_firstnamephonetic,eu.lastnamephonetic as eu_lastnamephonetic,eu.middlename as eu_middlename,eu.alternatename as eu_alternatename,eu.firstname as eu_firstname,eu.lastname as eu_lastname,eu.id as eu_id,eu.username as eu_username,eu.picture as eu_picture,eu.url as eu_url,eu.imagealt as eu_imagealt,eu.idnumber as eu_idnumber,eu.email as eu_email, du.firstnamephonetic as du_firstnamephonetic,du.lastnamephonetic as du_lastnamephonetic,du.middlename as du_middlename,du.alternatename as du_alternatename,du.firstname as du_firstname,du.lastname as du_lastname,du.id as du_id,du.username as du_username,du.picture as du_picture,du.url as du_url,du.imagealt as du_imagealt,du.idnumber as du_idnumber,du.email as du_email

, p8.parentpostid AS nextparent , p2.subject AS s2, p2.deleted AS d2, p3.subject AS s3, p3.deleted AS d3, p4.subject AS s4, p4.deleted AS d4, p5.subject AS s5, p5.deleted AS d5, p6.subject AS s6, p6.deleted AS d6, p7.subject AS s7, p7.deleted AS d7, p8.subject AS s8, p8.deleted AS d8 ,fd.id as fd_id,fd.forumngid as fd_forumngid,fd.groupid as fd_groupid,fd.postid as fd_postid,fd.lastpostid as fd_lastpostid,fd.timestart as fd_timestart,fd.timeend as fd_timeend,fd.deleted as fd_deleted,fd.locked as fd_locked,fd.sticky as fd_sticky, fdfp.subject AS fd_subject FROM mdl_forumng_posts fp INNER JOIN mdl_user u ON fp.userid = u.id LEFT JOIN mdl_user eu ON fp.edituserid = eu.id LEFT JOIN mdl_user du ON fp.deleteuserid = du.id

INNER JOIN mdl_forumng_discussions fd ON fp.discussionid = fd.id INNER JOIN mdl_forumng_posts fdfp ON fd.postid = fdfp.id

LEFT JOIN mdl_forumng_posts p2 ON p2.id = fp.parentpostid LEFT JOIN mdl_forumng_posts p3 ON p3.id = p2.parentpostid LEFT JOIN mdl_forumng_posts p4 ON p4.id = p3.parentpostid LEFT JOIN mdl_forumng_posts p5 ON p5.id = p4.parentpostid LEFT JOIN mdl_forumng_posts p6 ON p6.id = p5.parentpostid LEFT JOIN mdl_forumng_posts p7 ON p7.id = p6.parentpostid LEFT JOIN mdl_forumng_posts p8 ON p8.id = p7.parentpostid WHERE fd.forumngid = ? AND fp.userid = ? AND fp.oldversion = 0 AND fp.deleted = 0AND fp.created >= ? ORDER BY fd.forumngid

[array ( 0 => '2', 1 => 6, 2 => 1412287200, )] Error code: dmlreadexception Stack trace: line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown line 996 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end() line 944 of /mod/forumng/mod_forumng_post.php: call to mysqli_native_moodle_database->get_records_sql() line 4776 of /mod/forumng/mod_forumng.php: call to mod_forumng_post::query_posts() line 144 of /mod/forumng/feature/userposts/user.php: call to mod_forumng->get_all_posts_by_user()

Hope this helps, Mark.

jason-platts commented 9 years ago

Thanks, wondering if it is because there is no space before the "AND fp.created" - perhaps mysql errors.

Because of the funny way we put things on github we can't update the 2.6 branch without updating our live release branch - so I can update master only.

To (hopefully) fix update mod_forumng.php line 4766 and 4771 to "$where .= ' AND" (so add space before AND).

mfindlayated commented 9 years ago

Thanks very much, that seems to have fixed it. :)