Skip to content

Instantly share code, notes, and snippets.

@lukesaunders
Created October 14, 2011 16:21
Show Gist options
  • Save lukesaunders/1287568 to your computer and use it in GitHub Desktop.
Save lukesaunders/1287568 to your computer and use it in GitHub Desktop.
sign_ups_referred_to_date = FlupTrackingEvent.find(:event_type => "sign_up", :inviter => {:$ne => ""}, :created_at => {:$lte => new_time}).to_a
invites_to_date = FlupTrackingEvent.find(:event_type => "external_invite", :created_at => {:$lte => new_time}).to_a
@days << {
:day => this_time,
:invites => FlupTrackingEvent.find(:event_type => "external_invite", :created_at => {:$gte => this_time, :$lte => new_time}).to_a,
:sign_ups_total => FlupTrackingEvent.find(:event_type => "sign_up", :created_at => {:$gte => this_time, :$lte => new_time}).to_a,
:sign_ups_reffered => FlupTrackingEvent.find(:event_type => "sign_up", :inviter => {:$ne => ""}, :created_at => {:$gte => this_time, :$lte => new_time}).to_a,
:sign_ups_reffered_to_date => sign_ups_referred_to_date,
:items => FlupTrackingEvent.find(:created_at => {:$gte => this_time, :$lte => new_time}).to_a,
:invites_to_date => invites_to_date,
:sign_ups_to_date => FlupTrackingEvent.find(:event_type => "sign_up", :created_at => {:$lte => new_time}).to_a,
:invite_effect => sign_ups_referred_to_date.count / invites_to_date.count
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment