field_test 0.5.4 → 0.5.5

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: d72f2ad8e2e3848b2e28bc826a479322e0994c1a65f23217d6bbdd85e1a708e5
4
- data.tar.gz: 593a9d6292533404aaf5706e8d6efee44d168e659ef39b44f19d2c266259c69a
3
+ metadata.gz: f9182763b694b61f732e994e50f0b18f86d60fed181d302f885cd850f19831ae
4
+ data.tar.gz: b5c0e167d8f0e942dad04fd19f565ec54f38593b6cb4501c5a8631670046dc39
5
5
  SHA512:
6
- metadata.gz: 6605c5ba8800d72422bb121a9a27a7c1ac202022ce7fc37308b33ea77c9b0084e963c1b56d1ee54caf3b288abf16d4b91c86896b183bf8beba85ed98bf1e1113
7
- data.tar.gz: 5b4d3d12e2511cf8369b73ae64bdd5ff49a0d8a1160f6bda31ee180d658ea34ee3efe96fe43cb59625195ce0682a30cef15ac21f7084790e7c46258db7906333
6
+ metadata.gz: cde68d5e3a16b45e2d29e25c2bbf7fc74190bc69a7ef11477b808619d54764f1107f254ac9eea893468c48678bb64545cf99ca2d57ee3f570335210f12c4e08a
7
+ data.tar.gz: 9e82ce617955680184e3a79c01d1028e50a0a07ff26a6751cfffb47a68345223762742f41f40741ff52bd75e85c9706c845d438b4302544f5c923cdc211d6070
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.5.5 (2023-01-29)
2
+
3
+ - Added warning for non-string variants
4
+
1
5
  ## 0.5.4 (2022-06-16)
2
6
 
3
7
  - Fixed bug in results with MySQL and multiple goals (again)
data/README.md CHANGED
@@ -332,76 +332,6 @@ Now you can do:
332
332
  user.field_test_memberships
333
333
  ```
334
334
 
335
- ## Upgrading
336
-
337
- ### 0.3.0
338
-
339
- Upgrade the gem and add to `config/field_test.yml`:
340
-
341
- ```yml
342
- legacy_participants: true
343
- ```
344
-
345
- Also, if you use Field Test in emails, know that the default way participants are determined has changed. Restore the previous way with:
346
-
347
- ```ruby
348
- class ApplicationMailer < ActionMailer::Base
349
- def field_test_participant
350
- message.to.first
351
- end
352
- end
353
- ```
354
-
355
- We also recommend upgrading participants when you have time.
356
-
357
- #### Upgrading Participants
358
-
359
- Field Test 0.3.0 splits the `field_test_memberships.participant` column into `participant_type` and `participant_id`.
360
-
361
- To upgrade without downtime, create a migration:
362
-
363
- ```sh
364
- rails generate migration upgrade_field_test_participants
365
- ```
366
-
367
- with:
368
-
369
- ```ruby
370
- class UpgradeFieldTestParticipants < ActiveRecord::Migration[6.0]
371
- def change
372
- add_column :field_test_memberships, :participant_type, :string
373
- add_column :field_test_memberships, :participant_id, :string
374
-
375
- add_index :field_test_memberships, [:participant_type, :participant_id, :experiment],
376
- unique: true, name: "index_field_test_memberships_on_participant_and_experiment"
377
- end
378
- end
379
- ```
380
-
381
- After you run it, writes will go to both the old and new sets of columns.
382
-
383
- Next, backfill data:
384
-
385
- ```ruby
386
- FieldTest::Membership.where(participant_id: nil).find_each do |membership|
387
- participant = membership.participant
388
-
389
- if participant.include?(":")
390
- participant_type, _, participant_id = participant.rpartition(":")
391
- participant_type = nil if participant_type == "cookie" # legacy
392
- else
393
- participant_id = participant
394
- end
395
-
396
- membership.update!(
397
- participant_type: participant_type,
398
- participant_id: participant_id
399
- )
400
- end
401
- ```
402
-
403
- Finally, remove `legacy_participants: true` from the config file. Once you confirm it’s working, you can drop the `participant` column (you can rename it first just to be extra safe).
404
-
405
335
  ## Credits
406
336
 
407
337
  A huge thanks to [Evan Miller](https://www.evanmiller.org/) for deriving the Bayesian formulas.
@@ -8,6 +8,11 @@ module FieldTest
8
8
  @name = attributes[:name] || @id.to_s.titleize
9
9
  @description = attributes[:description]
10
10
  @variants = attributes[:variants]
11
+ if @variants.any? { |v| !v.is_a?(String) }
12
+ # TODO add support for more types (including query parameters)
13
+ # or raise error in 0.6
14
+ warn "[field_test] Only string variants are supported (#{id})"
15
+ end
11
16
  @weights = @variants.size.times.map { |i| attributes[:weights].to_a[i] || 1 }
12
17
  @winner = attributes[:winner]
13
18
  @closed = attributes[:closed]
@@ -1,3 +1,3 @@
1
1
  module FieldTest
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: field_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-17 00:00:00.000000000 Z
11
+ date: 2023-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  requirements: []
127
- rubygems_version: 3.3.7
127
+ rubygems_version: 3.4.1
128
128
  signing_key:
129
129
  specification_version: 4
130
130
  summary: A/B testing for Rails