sinmetrics 0.0.5 → 0.0.6.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -1,3 +1,2 @@
1
1
  coverage
2
- pkg
3
- *.gemspec
2
+ *.gem
@@ -203,6 +203,7 @@ module Sinatra
203
203
 
204
204
  module AbingoObject::ConversionRate
205
205
  def conversion_rate
206
+ return 0 if participants == 0
206
207
  1.0 * conversions / participants
207
208
  end
208
209
 
@@ -31,7 +31,8 @@ class Abingo::Experiment
31
31
  end
32
32
 
33
33
  def best_alternative
34
- alternatives.max do |a,b|
34
+ alts = Array.new alternatives.each { |a| a }
35
+ alts.max do |a,b|
35
36
  a.conversion_rate <=> b.conversion_rate
36
37
  end
37
38
  end
@@ -58,7 +58,7 @@ describe 'Abingo Specs' do
58
58
  @abingo.test("consistency_test", 1..100).should == alternative_picked
59
59
  end
60
60
  end
61
-
61
+
62
62
  it "should have working participation" do
63
63
  new_tests = %w{participationA participationB participationC}
64
64
  new_tests.map do |test_name|
@@ -101,6 +101,14 @@ describe 'Abingo Specs' do
101
101
  ex.conversions.should == 1
102
102
  end
103
103
 
104
+ it "should know the best alternative" do
105
+ test_name = "conversion_test_by_name"
106
+ alternative = @abingo.test(test_name, %w{a b c})
107
+ @abingo.bingo!(test_name)
108
+ ex = Abingo::Experiment.first(:test_name => test_name)
109
+ ex.best_alternative
110
+ end
111
+
104
112
  it "should track conversions by conversion name" do
105
113
  conversion_name = "purchase"
106
114
  tests = %w{conversionTrackingByConversionNameA conversionTrackingByConversionNameB conversionTrackingByConversionNameC}
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinmetrics
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ prerelease: true
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 5
9
- version: 0.0.5
8
+ - 6
9
+ - pre
10
+ version: 0.0.6.pre
10
11
  platform: ruby
11
12
  authors:
12
13
  - Luke Petre
@@ -142,11 +143,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
143
  version: "0"
143
144
  required_rubygems_version: !ruby/object:Gem::Requirement
144
145
  requirements:
145
- - - ">="
146
+ - - ">"
146
147
  - !ruby/object:Gem::Version
147
148
  segments:
148
- - 0
149
- version: "0"
149
+ - 1
150
+ - 3
151
+ - 1
152
+ version: 1.3.1
150
153
  requirements: []
151
154
 
152
155
  rubyforge_project: