summaryrefslogtreecommitdiff
path: root/show-edit-counts.rb
diff options
context:
space:
mode:
Diffstat (limited to 'show-edit-counts.rb')
-rwxr-xr-xshow-edit-counts.rb25
1 files changed, 16 insertions, 9 deletions
diff --git a/show-edit-counts.rb b/show-edit-counts.rb
index 4abd310..bcd5a3c 100755
--- a/show-edit-counts.rb
+++ b/show-edit-counts.rb
@@ -19,22 +19,23 @@ while not aufrom.nil? do
:aulimit => 5000,
:aufrom => aufrom)
for user in audata['query']['allusers']
- if user['blockid'].nil?
- if user['editcount'] == 0
- # optimize 0 edits means we don't need to count how many aren't deleted
- print "name: #{user['name']}\tregistration: #{user['registration']}\ttotal_editcount: 0\texisting_editcount: 0\n"
+ if user['editcount'] == 0
+ # optimize 0 edits means we don't need to count how many aren't deleted
+ print "name: #{user['name']}\tregistration: #{user['registration']}\ttotal_editcount: 0\texisting_editcount: 0"
+ if user['blockid'].nil?
+ print "\n"
else
- # queue this user for counting how many live edits they have
- userqueue.push(user)
+ print "\tblockreason: #{user['blockreason']}\n"
end
else
- print "name: #{user['name']}\tregistration: #{user['registration']}\tblockreason: #{user['blockreason']}\n"
+ # queue this user for counting how many live edits they have
+ userqueue.push(user)
end
end
aufrom = (audata['query-continue'].nil?) ? nil : audata['query-continue']['allusers']['aufrom']
end
-userqueue.each_slice(5000) do |userlist|
+userqueue.each_slice(500) do |userlist|
contribcount = {}
uccontinue = ''
while not uccontinue.nil?
@@ -54,6 +55,12 @@ userqueue.each_slice(5000) do |userlist|
uccontinue = (ucdata['query-continue'].nil?) ? nil : ucdata['query-continue']['usercontribs']['uccontinue']
end
userlist.each do |user|
- print "name: #{user['name']}\tregistration: #{user['registration']}\ttotal_editcount: #{user['editcount']}\texisting_editcount: #{contribcount[user['name']]}\n"
+ existing_editcount = contribcount[user['name']] || 0
+ print "name: #{user['name']}\tregistration: #{user['registration']}\ttotal_editcount: #{user['editcount']}\texisting_editcount: #{existing_editcount}"
+ if user['blockid'].nil?
+ print "\n"
+ else
+ print "\tblockreason: #{user['blockreason']}\n"
+ end
end
end