Created
January 8, 2015 21:04
-
-
Save samanthamjohn/20250ce8a12ba4e5d661 to your computer and use it in GitHub Desktop.
A script for finding what percentage of projects are liked/starred/etc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
categories = Category.all | |
categories.each do |c| | |
has_been_played = c.projects.where("has_been_removed IS NOT TRUE AND play_count > 0").count | |
all_projects = c.projects.where("has_been_removed IS NOT TRUE").count | |
ratio = has_been_played.to_f/all_projects.to_f | |
puts "#{c.label} has #{ratio*100} percent played" | |
has_been_starred = c.projects.where("has_been_removed IS NOT TRUE AND stars_count > 0").count | |
ratio = has_been_played.to_f/all_projects.to_f | |
puts "#{c.label} has #{ratio*100} percent played" | |
puts "#{c.label} has #{ratio*100} percent played" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment