Skip to content

Instantly share code, notes, and snippets.

@ashaegupta
Last active August 29, 2015 14:09
Show Gist options
  • Save ashaegupta/319b13cbb058686e61c9 to your computer and use it in GitHub Desktop.
Save ashaegupta/319b13cbb058686e61c9 to your computer and use it in GitHub Desktop.
Proxy for % of projects that are chatting
query = "To "
chats = Project.where("title LIKE ?", "#{query}%")
start_date = Time.now.beginning_of_week - 8.days // Sunday at Midnight to following Sunday at midnight
end_date = start_date + 7.days
range = start_date..end_date
all = Project.where(updated_at: range)
all.count
chats.where(updated_at: range)
chats.count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment