From 2706bd81897428985317cd12a12c8e81d76ed465 Mon Sep 17 00:00:00 2001 From: lokas Date: Fri, 31 May 2024 08:38:05 +0300 Subject: [PATCH 1/3] update query of list_of_portals_by_number_of_articles --- tasks/statistics/list_of_portals_by_number_of_articles.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tasks/statistics/list_of_portals_by_number_of_articles.py b/tasks/statistics/list_of_portals_by_number_of_articles.py index e59a018c..e98d6b0c 100644 --- a/tasks/statistics/list_of_portals_by_number_of_articles.py +++ b/tasks/statistics/list_of_portals_by_number_of_articles.py @@ -2,7 +2,11 @@ # Set the parameters for the update query = """SELECT main.page_title as portal_name, COUNT(*) - 1 as sub_page_count, - (SELECT COUNT(*) FROM pagelinks WHERE pl_title = main.page_title and pl_from_namespace = 0 and pl_namespace = 100) as links_count + ( + SELECT COUNT(*) FROM pagelinks + inner join linktarget ON lt_id = pl_target_id + WHERE lt_title = main.page_title and pl_from_namespace = 0 and lt_namespace = 100 + ) as links_count FROM page AS p INNER JOIN ( SELECT page_title From c5935705238e0d9c86b8b766c38b359541aa79c2 Mon Sep 17 00:00:00 2001 From: lokas Date: Fri, 31 May 2024 08:41:11 +0300 Subject: [PATCH 2/3] update query of list_of_contributors.py --- tasks/statistics/WikiProject/list_of_contributors.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasks/statistics/WikiProject/list_of_contributors.py b/tasks/statistics/WikiProject/list_of_contributors.py index 516931a1..66c5584b 100644 --- a/tasks/statistics/WikiProject/list_of_contributors.py +++ b/tasks/statistics/WikiProject/list_of_contributors.py @@ -5,11 +5,12 @@ query = """select actor_name as "username", count(rev_actor) as "edit_count", IF(actor_name in ( - select replace(pl_title,"_"," ") from pagelinks + select replace(lt_title,"_"," ") from pagelinks join page on page.page_id = pagelinks.pl_from + inner join linktarget ON lt_id = pl_target_id where page.page_namespace in (4) and page_title like "مشروع_ويكي_العراق/المساهمون" - and pl_namespace in (2) + and lt_namespace in (2) and pl_from_namespace in (4) ), "YES", "NO") as "in_WikiProject" From 05eb83a16e25ad93931437210835e323c09281b5 Mon Sep 17 00:00:00 2001 From: lokas Date: Fri, 31 May 2024 08:45:57 +0300 Subject: [PATCH 3/3] update query of articles_in_which_there_is_a_link_to_user_pages --- ..._in_which_there_is_a_link_to_user_pages.py | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/tasks/statistics/articles_in_which_there_is_a_link_to_user_pages.py b/tasks/statistics/articles_in_which_there_is_a_link_to_user_pages.py index a8c62d4d..97cd668d 100644 --- a/tasks/statistics/articles_in_which_there_is_a_link_to_user_pages.py +++ b/tasks/statistics/articles_in_which_there_is_a_link_to_user_pages.py @@ -1,18 +1,33 @@ from tasks.statistics.module import UpdatePage, ArticleTables, index # Set the parameters for the update -query = """select page.page_title as ll_page_title,pagelinks.pl_title as ll_page_to_title,pagelinks.pl_namespace as ll_pl_namespace -from page - inner join pagelinks - on pagelinks.pl_from = page.page_id -where pagelinks.pl_from_namespace = 0 - and (pagelinks.pl_namespace = 2 or pagelinks.pl_namespace = 3) - and page.page_namespace = 0 - and page.page_is_redirect = 0 - and page.page_id not in (select templatelinks.tl_from from templatelinks - join linktarget on linktarget.lt_id = templatelinks.tl_target_id - where linktarget.lt_title in (select pl_title from pagelinks where pl_from = 9043549) and templatelinks.tl_from_namespace = 0 ) - and page.page_title not in (select pl_title from pagelinks where pl_from = 9043549);""" +query = """SELECT page.page_title AS ll_page_title, + linktarget.lt_title AS ll_page_to_title, + linktarget.lt_namespace AS ll_pl_namespace +FROM page +INNER JOIN pagelinks ON pagelinks.pl_from = page.page_id +inner join linktarget ON lt_id = pl_target_id +WHERE pagelinks.pl_from_namespace = 0 + AND (linktarget.lt_namespace = 2 + OR linktarget.lt_namespace = 3) + AND page.page_namespace = 0 + AND page.page_is_redirect = 0 + AND page.page_id not in + (SELECT templatelinks.tl_from + FROM templatelinks + JOIN linktarget ON linktarget.lt_id = templatelinks.tl_target_id + WHERE linktarget.lt_title in + (SELECT lt_title + FROM pagelinks + inner join linktarget ON lt_id = pl_target_id + WHERE pl_from = 9043549) + AND templatelinks.tl_from_namespace = 0 ) + AND page.page_title not in + (SELECT lt_title + FROM pagelinks + inner join linktarget ON lt_id = pl_target_id + WHERE pl_from = 9043549 + );""" file_path = 'stub/articles_in_which_there_is_a_link_to_user_pages.txt' page_name = "ويكيبيديا:تقارير قاعدة البيانات/مقالات يوجد فيها وصلة إلى صفحات المستخدمين"