assaf / vanity

Experiment Driven Development for Ruby
http://vanity.labnotes.org
MIT License
1.55k stars 269 forks source link

Use existing assignment if available #253

Closed jmondo closed 9 years ago

jmondo commented 9 years ago

previously if probabilities feature was disabled, it would not use the existing assignment

use case: if you are doing an experiment and you want to grandfather old users by using ab_add_participant

description of problem: as of right now ab_add_participant won't do anything because when it hits AbTest#alternative_for, it just skips down to Digest::MD5.hexdigest("#{name}/#{identity}").to_i(17) % @alternatives.size and overwrites the alternative.

anyone willing to help me out with the failing test?

phillbaker commented 9 years ago

@jmondo thanks for the PR! We'll probably have to add an additional test to handle the new if/else case.

phillbaker commented 9 years ago

@jmondo thanks again for the PR. It looks like this was solved for unequal probabilities, but at the wrong level, in alternative_for instead of higher up in choose. I've fixed this and added a test case covering this behavior in 1bf8d6b.

jmondo commented 9 years ago

awesome! thanks so much :)