Class: Metry::Cohort
- Inherits:
-
Object
- Object
- Metry::Cohort
- Includes:
- MongoMapper::Document
- Defined in:
- lib/metry/cohort.rb
Instance Method Summary collapse
Instance Method Details
#reached_goal(goal) ⇒ Object
14 15 16 17 |
# File 'lib/metry/cohort.rb', line 14 def reached_goal(goal) goal_visitor_ids = goal.visitors.collect{|e| e.id} (goal_visitor_ids & visitor_ids).size.to_f/visitor_ids.size.to_f end |
#visitors ⇒ Object
10 11 12 |
# File 'lib/metry/cohort.rb', line 10 def visitors [(visitor_ids.empty? ? nil : Visitor.find(visitor_ids))].flatten end |