summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-01-24 23:59:16 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-01-24 23:59:16 -0500
commitda95f2153daf15b0fd347f7bf1767c70499c459f (patch)
tree7c4c86a0b55973cc23227c8f98fea9ca6ddc6213
parentf4f2ba7c7fb35e122bba7c2926d5bc8e07cbcf75 (diff)
fix 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