Jump to content

Wikipedia:Database reports/Active editors with the longest-established accounts/Configuration

From Wikipedia, the free encyclopedia

This report is updated every 28 days.

Source code

[edit]
/*Copyright Thparkth, MaxSemCopyright 2021 Kunal Mehta <legoktm@debian.org>This program is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>. */useanyhow::Result;usedbreps2::{str_vec,Frequency,Report};usemysql_async::prelude::*;usemysql_async::Conn;pubstructRow{user_name: String,user_registration: String,user_editcount: u32,}pubstructOldEditors{}implReport<Row>forOldEditors{fntitle(&self)-> &'staticstr{"Active editors with the longest-established accounts"}fnfrequency(&self)-> Frequency{Frequency::Monthly}fnquery(&self)-> &'staticstr{r#"/* oldeditors.rs SLOW_OK */SELECT user_name, user_registration, user_editcountFROM ( SELECT user_name, user_registration, user_editcount FROM user WHERE user_id IN ( SELECT DISTINCT actor_user FROM actor_recentchanges WHERE actor_user > 0 ) AND user_registration IS NOT NULL ORDER BY user_id LIMIT 250 ) AS InnerQueryORDER BY user_registrationLIMIT 200"#}asyncfnrun_query(&self,conn: &mutConn)-> Result<Vec<Row>>{letrows=conn.query_map(self.query(),|(user_name,user_registration,user_editcount)|Row{user_name,user_registration,user_editcount,},).await?;Ok(rows)}fnintro(&self)-> &'staticstr{"The 200 earliest-created editor accounts that have been active in the last thirty days"}fnheadings(&self)-> Vec<&'staticstr>{vec!["Username","Account creation","Approx. edit count"]}fnformat_row(&self,row: &Row)-> Vec<String>{str_vec![format!("[[User:{}|]]",&row.user_name),row.user_registration,row.user_editcount]}fncode(&self)-> &'staticstr{include_str!("oldeditors.rs")}}
close