Skip to content

Commit

Permalink
return storedVariation if we have one (#6904)
Browse files Browse the repository at this point in the history
  • Loading branch information
rralian authored Jul 19, 2016
1 parent 6b55225 commit 02e50a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/lib/abtest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {

You should include the following information:

* `datestamp` - The YYYMMDD date you want to start tracking the results of the test. If you deploy to production prior to this date, the `abtest` function (see below) will return the value you set for `defaultVariation` and won't track the results.
* `datestamp` - The YYYMMDD date you want to start tracking the results of the test. If you deploy to production prior to this date, the `abtest` function (see below) will return the any stored variation (which makes for easier testing) or the value you set for `defaultVariation` and won't track the results.
* `variations` - An object where the keys are the variation names and the values are the allocations. The variation names should be descriptive (don't use `variationA`, `original`, etc). The allocations (50/50) are how you want those variations to be allocated to users. For example, you could also do 90/10 if you want one variation to be shown to only 10% of users. 90/10 is the same as 9/1. If you had three variations you could do 1/1/1 to show each variation one third of the time.
* `defaultVariation` - The variation to assign users who are not eligible to participate in the test. See the "Dealing with ineligible users" section below for more information.

Expand Down
2 changes: 1 addition & 1 deletion client/lib/abtest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ ABTest.prototype.getVariationAndSetAsNeeded = function() {

if ( ! this.hasTestStartedYet() ) {
debug( '%s: Test will start on %s.', this.experimentId, this.datestamp );
return this.defaultVariation;
return savedVariation || this.defaultVariation;
}

if ( savedVariation && includes( this.variationNames, savedVariation ) ) {
Expand Down

0 comments on commit 02e50a6

Please sign in to comment.