Skip to content

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

@acquaalta

Description

@acquaalta

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 :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions