Skip to content

Instantly share code, notes, and snippets.

@thefron
Created January 17, 2014 08:19
Show Gist options
  • Save thefron/8470045 to your computer and use it in GitHub Desktop.
Save thefron/8470045 to your computer and use it in GitHub Desktop.
dates_matchings = {}
Matching.unscoped.select([:id, :created_at]).find_each do |matching|
dates_matchings[matching.created_at.to_date.to_s] ||= 0
dates_matchings[matching.created_at.to_date.to_s] += 1
end; nil
dates_matchings.sort.each do |date, matchings_count|
puts "#{date}\t#{matchings_count}"
end; nil
dates_matchings = {}
Matching.unscoped.includes(:player).where('matchings.id > 16925949').select([:id, :player_id, :created_at]).find_in_batches do |matchings|
matchings.select { |m| m.player.service_zone_id == 'taiwan' }.each do |matching|
dates_matchings[matching.created_at.to_date.to_s] ||= 0
dates_matchings[matching.created_at.to_date.to_s] += 1
end
end; nil
dates_matchings.sort.each do |date, matchings_count|
puts "#{date}\t#{matchings_count}"
end; nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment