From da95f2153daf15b0fd347f7bf1767c70499c459f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 24 Jan 2014 23:59:16 -0500 Subject: fix show-edit-counts.rb --- show-edit-counts.rb | 25 ++++++++++++++++--------- 1 file 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 -- cgit v1.2.3-54-g00ecf