moodleou / moodle-mod_forumng

ForumNG forum module for Moodle
19 stars 20 forks source link

3.1 error on course & Dashboard pages #68

Closed aspark21 closed 7 years ago

aspark21 commented 7 years ago

Moodle: Latest 3.1 stable branch ForumNG: latest master branch Database: MySQL 5.5

Thanks for the release today!

Just did some testing & getting the following error on the course page & dashboard for courses with a ForumNG activity in them - oddly enough creating a new one or once in the activity everything works fine inside the forumNG activity - just not on the course page & dashboard.

Debug info: Unknown column 'f.type' in 'where clause'

SELECT f.id as f_id,f.course as f_course,f.name as f_name,f.type as f_type,f.intro as f_intro,f.ratingscale as f_ratingscale,f.ratingfrom as f_ratingfrom,f.ratinguntil as f_ratinguntil,f.grading as f_grading,f.attachmentmaxbytes as f_attachmentmaxbytes,f.reportingemail as f_reportingemail,f.subscription as f_subscription,f.feedtype as f_feedtype,f.feeditems as f_feeditems,f.maxpostsperiod as f_maxpostsperiod,f.maxpostsblock as f_maxpostsblock,f.postingfrom as f_postingfrom,f.postinguntil as f_postinguntil,f.typedata as f_typedata,f.magicnumber as f_magicnumber,f.originalcmid as f_originalcmid,f.shared as f_shared,f.canpostanon as f_canpostanon,f.enabletags as f_enabletags,f.enableratings as f_enableratings, cm.id as cm_id,cm.course as cm_course,cm.module as cm_module,cm.instance as cm_instance,cm.section as cm_section,cm.added as cm_added,cm.score as cm_score,cm.indent as cm_indent,cm.visible as cm_visible,cm.visibleold as cm_visibleold,cm.groupmode as cm_groupmode,cm.groupingid as cm_groupingid,cm.idnumber as cm_idnumber,cm.completion as cm_completion,cm.completiongradeitemnumber as cm_completiongradeitemnumber,cm.completionview as cm_completionview,cm.completionexpected as cm_completionexpected, c.id as c_id,c.shortname as c_shortname,c.fullname as c_fullname,c.format as c_format, (SELECT COUNT(1) FROM mdl_forumng_discussions cfd JOIN mdl_forumng_posts cfp ON cfd.postid = cfp.id WHERE cfd.forumngid = f.id AND cfd.deleted = 0 AND ( ((cfd.timestart = 0 OR cfd.timestart <= ?) AND (cfd.timeend = 0 OR cfd.timeend > ?)) OR (cfd.forumngid = ?) ) AND (f.type != ? OR cfp.userid = ? OR (cfd.forumngid = ?)) AND ( (cfd.groupid IS NULL) OR ((1=0)) OR cm.groupmode = 2 OR (cfd.forumngid = ?) )) AS f_numdiscussions, (EXISTS (SELECT 1 FROM (SELECT fd.id, fr.time, fd.forumngid FROM mdl_forumng_discussions fd INNER JOIN mdl_forumng_posts fplast ON fd.lastpostid = fplast.id INNER JOIN mdl_forumng_posts fpfirst ON fd.postid = fpfirst.id LEFT JOIN mdl_forumng_read fr ON fd.id = fr.discussionid AND fr.userid = ? INNER JOIN mdl_course_modules cm2 ON cm2.instance = fd.forumngid AND cm2.module = (SELECT id FROM mdl_modules WHERE name = 'forumng') WHERE fplast.modified > ? AND (f.type != ? OR fpfirst.userid = ? OR (fd.forumngid = ?)) AND ( (fd.groupid IS NULL) OR ((1=0)) OR cm2.groupmode = 2 OR (fd.forumngid = ?) ) AND fd.deleted = 0 AND ( ((fd.timestart = 0 OR fd.timestart <= ?) AND (fd.timeend = 0 OR fd.timeend > ? OR (fd.forumngid = ?))) ) AND ((fplast.edituserid IS NOT NULL AND fplast.edituserid <> ?) OR fplast.userid <> ?) AND (fr.time IS NULL OR fplast.modified > fr.time)

) discussions

WHERE discussions.forumngid = f.id ))AS f_hasunreaddiscussions FROM mdl_forumng f INNER JOIN mdl_course_modules cm ON cm.instance = f.id AND cm.module = (SELECT id from mdl_modules WHERE name = 'forumng') INNER JOIN mdl_course c ON c.id = f.course WHERE f.course = ? AND cm.id = ? ORDER BY LOWER(f.name) [array ( 0 => 1479389813, 1 => 1479389813, 2 => '1', 3 => 'studyadvice', 4 => '2', 5 => '1', 6 => '1', 7 => '2', 8 => 1474205813, 9 => 'studyadvice', 10 => '2', 11 => '1', 12 => '1', 13 => 1479389813, 14 => 1479389813, 15 => '1', 16 => '2', 17 => '2', 18 => '2', 19 => '3', )] Error code: dmlreadexception

aspark21 commented 7 years ago

Looks like it's definetely an issue for MySQL but not for Postgres. I have run the master branch trough travis:

MySQL - https://travis-ci.org/aspark21/moodle-mod_forumng/jobs/176746733#L7609 PGSQL - https://travis-ci.org/aspark21/moodle-mod_forumng/jobs/176746732#L7609

jason-platts commented 7 years ago

Thanks for the report.

Wondering it should be f_type rather than type in the where

jason-platts commented 7 years ago

Just fixed this, will be updated at our next push (will get that done soon).

aspark21 commented 7 years ago

Thanks Jason! Much appreciated.