Skip to content

Instantly share code, notes, and snippets.

@arfon
Last active August 25, 2020 08:48
Embed
What would you like to do?
How to calculate how many people have reviewed for JOSS
### Find all the published reviewers
papers = Paper.visible
reviewers = []
papers.each { |p| reviewers << p.reviewers.each(&:downcase!) }
### Unique reviewers (922)
puts reviewers.flatten.uniq.count
### Find the highest reviewer counts
reviewer_counts = Hash.new(0)
reviewers.flatten.each do |reviewer_instance|
if reviewer_counts.has_key?(reviewer_instance)
reviewer_counts[reviewer_instance] += 1
else
reviewer_counts[reviewer_instance] = 1
end
end
sorted = reviewer_counts.sort_by { |_key,value| value }.reverse.to_h
reviewer_table = File.open("reviewers.md", 'w')
reviewer_table.puts "| Handle | Count |"
reviewer_table.puts "|---|---|"
sorted.take(50).to_h.each do |reviewer, count|
next if reviewer == "@arfon"
reviewer_table.puts "| #{reviewer} | #{count} |"
end
reviewer_table.close
Handle Count
@luizirber 13
@amoeba 10
@brainstorm 8
@haozeke 8
@nicoguaro 8
@chilipp 8
@krother 7
@kevin-mattheus-moerman 7
@trallard 7
@fil 7
@zhampel 7
@dvalters 7
@kyleniemeyer 7
@corybrunson 7
@mattpitkin 7
@jsgalan 7
@rougier 6
@vsoch 6
@benmarwick 6
@ahwillia 6
@ziotom78 6
@acolum 6
@djmitche 6
@tacaswell 6
@kellieotto 6
@strengejacke 6
@mkhorton 6
@nhejazi 6
@ejhigson 6
@danielskatz 6
@stuartcampbell 5
@terrytangyuan 5
@hugoledoux 5
@jsta 5
@sgrieve 5
@mdoucet 5
@vc1492a 5
@ixjlyons 5
@mnarayan 5
@desilinguist 5
@iljah 5
@jdeligt 5
@sirsharpest 5
@nnadeau 5
@dfm 4
@richardlitt 4
@mgalloy 4
@benjamin-lee 4
@faustincarter 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment