learnweb / moodle-mod_moodleoverflow

:speech_balloon: Non-linear discussion module for Q&A forums
GNU General Public License v3.0
12 stars 22 forks source link

Bug - "View user statistics" produces an error #164

Open acquaalta opened 11 months ago

acquaalta commented 11 months ago

Hi, Moodle version: 4.1.3 Plugin version: v4.2-r1

When pressing the "View user statistics" button in a specific Moodleoverflow activity, I get the following error/exception:

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 'OVER (ORDER BY ratings.id)) AS row_num, ratings.id A' at line 1 SELECT (ROW_NUMBER() OVER (ORDER BY ratings.id)) AS row_num, ratings.id AS rateid, discuss.userid AS discussuserid, posts.id AS postid, posts.userid AS postuserid, ratings.rating AS rating, ratings.userid AS rateuserid, ratings.postid AS ratepostid, discuss.id AS discussid, posts.discussion AS postdiscussid, ratings.discussionid AS ratediscussid FROM mdl_moodleoverflow_discussions discuss LEFT JOIN mdl_moodleoverflow_posts posts ON discuss.id = posts.discussion LEFT JOIN mdl_moodleoverflow_ratings ratings ON posts.id = ratings.postid WHERE discuss.course = 7; [array ( )] Error code: dmlreadexception Dismiss this notification Stack trace: line 494 of /lib/dml/moodle_database.php: dml_read_exception thrown line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end() line 1278 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end() line 206 of /mod/moodleoverflow/classes/tables/userstats_table.php: call to mysqli_native_moodle_database->get_records_sql() line 81 of /mod/moodleoverflow/classes/tables/userstats_table.php: call to mod_moodleoverflow\tables\userstats_table->get_table_data() line 67 of /mod/moodleoverflow/userstats.php: call to mod_moodleoverflow\tables\userstats_table->__construct()

Could you please check if this as an issue that can somehow get fixed?

Thanks :-)

NinaHerrmann commented 11 months ago

@TamaroWalter

TamaroWalter commented 11 months ago

Hi, thank you for your feedback. We tried to reproduce the bug on our moodle system but couldn't find it. Is there more information about the bug? Is there something different in the specific moodleoverflow to others in your system? What is your mysql-version? As the bug refers to the SQL-Syntax it could be a version problem with your current my-sql version

In our new plugin version v4.2-r2 the userstats feature improved. If you want you can update your plugin version and test if the bug is still there.

acquaalta commented 11 months ago

Hi,

  1. It happens in every Moodleoverflow activity I created in the system. When I wrote the original report I had a memory that it's a problem in a specific Moodleoverflow forum only.

  2. It doesn't seem like an issue with a specific content in the activity that causes this bug. I checked and it happens even in an empty forum (Moodleoverflow activity).

  3. It happens on a system with MySQL v8.1