Skip to content

Commit

Permalink
Merge pull request #265 from LokasWiki/statistics_v2.3.3
Browse files Browse the repository at this point in the history
add list_of_wikipedians_by_number_of_files_uploaded.py
  • Loading branch information
loka1 authored Aug 28, 2023
2 parents fac6ad6 + 1f80111 commit e5d38bc
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from tasks.statistics.module import UpdatePage, ArticleTables, index

# Set the parameters for the update
query = """select count(log_id) as "count_of_uploads", actor_name
from logging_userindex
inner join actor on actor_id = logging_userindex.log_actor
where log_type like "upload"
GROUP BY log_actor
order by count(log_id) desc
limit 500;"""
file_path = 'stub/list_of_wikipedians_by_number_of_files_uploaded.txt'
page_name = "ويكيبيديا:قائمة الويكيبيديين حسب عدد الملفات المرفوعة"


def username(row, result, index):
user_name = str(row['actor_name'], 'utf-8')
name = user_name.replace("__", "[LOKA]").replace("_", " ").replace("[LOKA]", "_")
return "[[مستخدم:" + user_name + "|" + name + "]]"


columns = [
("الرقم", None, index),
("المستخدم", None, username),
("عدد الملفات المرفوعة", "count_of_uploads"),
]


def main(*args: str) -> int:
# Create an instance of the ArticleTables class
tables = ArticleTables()
tables.add_table("main_table", columns)

# Create an instance of the updater and update the page
updater = UpdatePage(query, file_path, page_name, tables)
updater.update()
return 0


if __name__ == "__main__":
raise SystemExit(main())
2 changes: 1 addition & 1 deletion tasks/statistics/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self):
self.site = pywikibot.Site()
self._page_name = ""
self.contents = ""
self._summary = "بوت:إحصاءات V2.3.2"
self._summary = "بوت:إحصاءات V2.3.3"

@property
def page_name(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div style="background: #E5E4E2; padding: 0.5em; font-family: Traditional Arabic; font-size: 130%; -moz-border-radius: 0.3em; border-radius: 0.3em;">
<center>
تعرض هذه الصفحة قائمة الـ500 [[ويكيبيديا:ويكيبيديون|ويكيبيدي]] الأوائل حسب عدد الملفات المرفوعة محليًا (مع احتساب [[ويكيبيديا:بوت|البوتات]]).
<br />
'''حَدَّث BOT_USER_NAME هذه القائمة في : BOT_TIME_NOW (ت ع م) '''
</center>
</div>
<center>
<div style="background: #E5E4E2; padding: 0.5em; -moz-border-radius: 0.3em; border-radius: 0.3em;">
BOT_TABLE_BODY
</div>
</center>

[[تصنيف:إحصاءات ويكيبيديا]]
[[تصنيف:ويكيبيديا قائمة الويكيبيديين حسب عدد التعديلات]]
[[تصنيف:إحصاءات يحدثها LokasBot]]

0 comments on commit e5d38bc

Please sign in to comment.