From 205c03f12b8db31f7459121a4f08ef567b2d66ec Mon Sep 17 00:00:00 2001 From: loka shafeek <34503724+loka1@users.noreply.github.com> Date: Thu, 22 Aug 2024 08:35:40 +0300 Subject: [PATCH] Update data.py --- tasks/users_this_week/data.py | 62 ++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/tasks/users_this_week/data.py b/tasks/users_this_week/data.py index a922570e..07a28e6e 100644 --- a/tasks/users_this_week/data.py +++ b/tasks/users_this_week/data.py @@ -66,10 +66,11 @@ WHERE ug_group = "bot") and log_action = "approve-i" and log_namespace = 0 - and actor_name not in (SELECT replace(pl_title,"_"," ") -FROM pagelinks -where pagelinks.pl_from = 7352181 -and pl_namespace = 2) + and actor_name not in (SELECT replace(lt_title, "_", " ") + FROM pagelinks + inner join linktarget ON lt_id = pl_target_id + WHERE pagelinks.pl_from = 7352181 + AND lt_namespace = 2) group by actor_name having COUNT(*) > 1 ORDER BY score DESC,name @@ -90,10 +91,11 @@ where log_timestamp BETWEEN START_WEEK_DATE AND END_WEEK_DATE and log_type in ("block", "protect", "delete", "rights") and actor_name IN (SELECT user_name FROM user_groups INNER JOIN user ON user_id = ug_user WHERE ug_group = 'sysop') -and actor_name not in (SELECT replace(pl_title,"_"," ") -FROM pagelinks -where pagelinks.pl_from = 7352181 -and pl_namespace = 2) +and actor_name not in (SELECT replace(lt_title, "_", " ") + FROM pagelinks + inner join linktarget ON lt_id = pl_target_id + WHERE pagelinks.pl_from = 7352181 + AND lt_namespace = 2) group by logging.log_actor having COUNT(*)>1 ORDER BY score DESC,name @@ -128,10 +130,11 @@ INNER JOIN user ON user_id = ug_user WHERE ug_group = "bot") and actor_name IN (SELECT user_name FROM user_groups INNER JOIN user ON user_id = ug_user WHERE ug_group = 'editor' or 'autoreview') -and actor_name not in (SELECT replace(pl_title,"_"," ") -FROM pagelinks -where pagelinks.pl_from = 7352181 -and pl_namespace = 2) +and actor_name not in (SELECT replace(lt_title, "_", " ") + FROM pagelinks + inner join linktarget ON lt_id = pl_target_id + WHERE pagelinks.pl_from = 7352181 + AND lt_namespace = 2) GROUP BY actor_name having score > 0 ORDER BY score DESC,name @@ -156,10 +159,11 @@ and actor_name Not IN (SELECT user_name FROM user_groups INNER JOIN user ON user_id = ug_user WHERE ug_group = 'bot') and ucase(actor_name) not like ucase("%BOT") COLLATE utf8mb4_general_ci and actor_name not like "%بوت%" collate utf8mb4_general_ci -and actor_name not in (SELECT replace(pl_title,"_"," ") -FROM pagelinks -where pagelinks.pl_from = 7352181 -and pl_namespace = 2) +and actor_name not in (SELECT replace(lt_title, "_", " ") + FROM pagelinks + inner join linktarget ON lt_id = pl_target_id + WHERE pagelinks.pl_from = 7352181 + AND lt_namespace = 2) group by logging.log_actor having COUNT(*)>1 ORDER BY score DESC,name @@ -186,10 +190,11 @@ AND ucase(actor_name) NOT LIKE ucase("%BOT") COLLATE utf8mb4_general_ci AND actor_name NOT LIKE "%بوت%" collate utf8mb4_general_ci AND actor_name NOT IN (SELECT user_name FROM user_groups INNER JOIN user ON user_id = ug_user WHERE ug_group = "bot") -and actor_name not in (SELECT replace(pl_title,"_"," ") -FROM pagelinks -where pagelinks.pl_from = 7352181 -and pl_namespace = 2) +and actor_name not in (SELECT replace(lt_title, "_", " ") + FROM pagelinks + inner join linktarget ON lt_id = pl_target_id + WHERE pagelinks.pl_from = 7352181 + AND lt_namespace = 2) GROUP BY actor_name HAVING score > 0 ORDER BY score DESC,name @@ -216,10 +221,11 @@ AND ucase(actor_name) NOT LIKE ucase("%BOT") COLLATE utf8mb4_general_ci AND actor_name NOT LIKE "%بوت%" collate utf8mb4_general_ci and actor_name NOT IN (SELECT user_name FROM user_groups INNER JOIN user ON user_id = ug_user WHERE ug_group = 'editor' or 'autoreview' or 'bot') -and actor_name not in (SELECT replace(pl_title,"_"," ") -FROM pagelinks -where pagelinks.pl_from = 7352181 -and pl_namespace = 2) +and actor_name not in (SELECT replace(lt_title, "_", " ") + FROM pagelinks + inner join linktarget ON lt_id = pl_target_id + WHERE pagelinks.pl_from = 7352181 + AND lt_namespace = 2) GROUP BY actor_name ORDER BY score DESC,name LIMIT 10; @@ -238,7 +244,11 @@ INNER JOIN actor on rev.rev_actor = actor_id WHERE rev_timestamp BETWEEN START_WEEK_DATE AND END_WEEK_DATE AND actor_name IN (SELECT user_name FROM user_groups INNER JOIN user ON user_id = ug_user WHERE ug_group = "bot") -and actor_name not in (SELECT replace(pl_title,"_"," ") FROM pagelinks where pagelinks.pl_from = 7352181 and pl_namespace = 2) +and actor_name not in (SELECT replace(lt_title, "_", " ") + FROM pagelinks + inner join linktarget ON lt_id = pl_target_id + WHERE pagelinks.pl_from = 7352181 + AND lt_namespace = 2) and actor_name not in ( "New user message", "MediaWiki message delivery", @@ -249,4 +259,4 @@ ORDER BY score DESC,name LIMIT 15;""" }, -] \ No newline at end of file +]