Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yangxing-star/8858008 to your computer and use it in GitHub Desktop.
Save yangxing-star/8858008 to your computer and use it in GitHub Desktop.
users = User.where(:nickname.in => ["橙子","柏图卡","1circle","jensen鑫","老猴走四方","琳子想要跑着玩","神叨M"])
a = []
users.each do |user|
b = 0
user.referring.each do |r|
if ("2014-01-01 00:00:00".to_datetime.."2014-01-31 23:59:59".to_datetime).cover?(r.created_at)
if r.referred?
b += 1
end
end
end
a << { user.nickname => b }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment