From 2a9228e24476b603ca00f4671c10443708b50e82 Mon Sep 17 00:00:00 2001 From: discomrade <83621080+discomrade@users.noreply.github.com> Date: Mon, 17 Jun 2024 01:30:03 +0000 Subject: [PATCH] [statistics] sort by tag id for correctness Sorting by user.id was an oversight which caused tags to be miscredited when comparing against the previous tag history entry for an image. For example, whoever had the lowest user ID (rather than the uploader) had their entry considered the initial tag list. --- ext/statistics/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/statistics/main.php b/ext/statistics/main.php index 029615bd..4bdb10ee 100644 --- a/ext/statistics/main.php +++ b/ext/statistics/main.php @@ -95,7 +95,7 @@ class Statistics extends Extension { global $database; // Returns the username and tags from each tag history entry. This includes Anonymous tag histories to prevent their tagging being ignored and credited to the next user to edit. - $tag_stats = $database->get_all("SELECT users.class,users.name,tag_histories.tags,tag_histories.image_id FROM tag_histories INNER JOIN users ON users.id = tag_histories.user_id WHERE 1=1 ORDER BY users.id;"); + $tag_stats = $database->get_all("SELECT users.class,users.name,tag_histories.tags,tag_histories.image_id FROM tag_histories INNER JOIN users ON users.id = tag_histories.user_id WHERE 1=1 ORDER BY tag_histories.id;"); // Group tag history entries by image id $tag_histories = [];