splut 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68c305af3255702202f540d3fbfb48884f6534a40a35a919860c32d5eb5510d4
|
4
|
+
data.tar.gz: 1f49ff4e1776c996c76aea31e6e15e5f6368ae80f07b2bec0a74940394545535
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6db83b5bc8a491e9c2118b9c695a39c81560a0fe1f9f18d2587fc3ef57a2f5df4d59c0f0403766151b0dbcecada88f65a34f13ba96a3ca279c1f5abb673c7aa8
|
7
|
+
data.tar.gz: 6d06e3deb5058cdcba53634200b4002a37953ace0d72f29edd2411ea102f3cf747866c5df75a7cdb677338a97f23ee3149ab04ed496c9d2fb9203f601f4c406f
|
@@ -13,9 +13,9 @@ class CreateSplutTables < ActiveRecord::Migration<%= migration_version %>
|
|
13
13
|
t.string :name
|
14
14
|
t.string :letter_designation
|
15
15
|
t.integer :_impression_total, default: 0, null: false
|
16
|
-
t.integer :
|
16
|
+
t.integer :_segment_total, default: 0, null: false
|
17
17
|
t.integer :_impression_success, default: 0, null: false
|
18
|
-
t.integer :
|
18
|
+
t.integer :_segment_success, default: 0, null: false
|
19
19
|
|
20
20
|
t.timestamps
|
21
21
|
end
|
@@ -8,11 +8,16 @@ module Splut
|
|
8
8
|
|
9
9
|
|
10
10
|
def is_in_group?(splutable_thing)
|
11
|
-
|
12
|
-
|
11
|
+
existing_segment_participant = SegmentParticipant.find_by(variation_id: self.variations.collect(&:id),
|
12
|
+
splutable: splutable_thing)
|
13
|
+
|
13
14
|
end
|
14
15
|
|
15
16
|
def participate!(splutable_thing)
|
17
|
+
|
18
|
+
if self.variations.none?
|
19
|
+
raise "participate! was called on experiment #{self.name} (id #{self.id} but there are no variations)"
|
20
|
+
end
|
16
21
|
# will return the segment participant if the
|
17
22
|
# thing is already in the experiment
|
18
23
|
#
|
@@ -29,6 +34,7 @@ module Splut
|
|
29
34
|
this_variation = self.variations[random]
|
30
35
|
|
31
36
|
puts "Putting #{splutable_thing} into variation #{this_variation}"
|
37
|
+
|
32
38
|
segment_participant = this_variation.segment_participants.create!(splutable: splutable_thing)
|
33
39
|
|
34
40
|
else
|
@@ -7,16 +7,15 @@ module Splut
|
|
7
7
|
|
8
8
|
belongs_to :variation
|
9
9
|
belongs_to :splutable, polymorphic: true
|
10
|
+
has_many :impressions
|
10
11
|
|
11
12
|
counter_culture :variation, column_name: :_segment_total
|
12
13
|
counter_culture :variation, column_name: proc {|model| model.success ? '_segment_success' : nil }
|
13
14
|
|
14
15
|
def success!
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
#
|
19
|
-
# set this + the last impression to successful
|
16
|
+
|
17
|
+
self.update(success: true, success_at: DateTime.current)
|
18
|
+
self.impressions.last.update(success: true, success_at: DateTime.current)
|
20
19
|
end
|
21
20
|
end
|
22
21
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splut
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Fleetwood-Boldt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rails
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '5.1'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '5.1'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: counter_culture
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|