splut 0.0.1 → 0.0.3
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e0870a17a1642759d572c7417d4ce1e482cfbabedaae9a63a22a76810622b3e
|
4
|
+
data.tar.gz: ff87becf1d51811269966fb282f95b0b6d4497d6113522db023c462571b81b51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 244db7966070409bf04102ac1d6c1fb3835929f3d51d4f12ddc5ce9456485cce27778f26dbbabf78259f2a1a7646ef1247143a38d7f4bce940276bcbb0773acd
|
7
|
+
data.tar.gz: c7e80e9e41fa660392dcb8a9da2b59c90c5616a82b00378427d23fb92b5ab7b5e08cea605168e025ce627222ef234f3804fc2d1392815a5f44d84b34ef07d484
|
@@ -12,14 +12,34 @@ module Splut
|
|
12
12
|
# but will not segement them
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
15
|
+
def participate!(splutable_thing)
|
16
16
|
# will return the segment participant if the
|
17
17
|
# thing is already in the experiment
|
18
18
|
#
|
19
19
|
#
|
20
20
|
# will put the participant into the experiment if not
|
21
|
-
|
21
|
+
#
|
22
|
+
segment_participant = Splut::SegmentParticipant.find_by(
|
23
|
+
variation_id: self.variations.collect(&:id),
|
24
|
+
splutable: splutable_thing)
|
25
|
+
|
26
|
+
if !segment_participant
|
27
|
+
random = rand(self.variations.count).floor
|
28
|
+
|
29
|
+
this_variation = self.variations[random]
|
22
30
|
|
31
|
+
puts "Putting #{splutable_thing} into variation #{this_variation}"
|
32
|
+
segment_participant = this_variation.segment_participants.create!(splutable: splutable_thing)
|
23
33
|
|
34
|
+
else
|
35
|
+
puts " #{splutable_thing} was already in variation #{this_variation}"
|
36
|
+
this_variation = segment_participant.variation
|
37
|
+
end
|
38
|
+
|
39
|
+
impression = this_variation.impressions.create!(splutable: splutable_thing,
|
40
|
+
segment_participant: segment_participant)
|
41
|
+
|
42
|
+
impression
|
43
|
+
end
|
24
44
|
end
|
25
45
|
end
|
@@ -8,7 +8,7 @@ module Splut
|
|
8
8
|
belongs_to :variation
|
9
9
|
|
10
10
|
belongs_to :splutable, polymorphic: true
|
11
|
-
|
11
|
+
belongs_to :segment_participant
|
12
12
|
|
13
13
|
counter_culture :variation, column_name: '_impression_total'
|
14
14
|
counter_culture :variation, column_name: proc {|model| model.success ? '_impression_success' : nil }
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Fleetwood-Boldt
|
@@ -78,7 +78,7 @@ files:
|
|
78
78
|
- lib/splut.rb
|
79
79
|
- lib/splut/models/experiment.rb
|
80
80
|
- lib/splut/models/impression.rb
|
81
|
-
- lib/splut/models/
|
81
|
+
- lib/splut/models/segment_participant.rb
|
82
82
|
- lib/splut/models/variation.rb
|
83
83
|
- lib/version.rb
|
84
84
|
homepage: https://heliosdev.shop/splut/
|