Skip to content

Commit

Permalink
BUGFIX: testSequence is a bit more delicate with the new randomizer
Browse files Browse the repository at this point in the history
testSequence is by default the main one specified for an experiment.
If we are using the user-specific test sequences, after loading the
default, we have to switch over to the user-specific ones.

This bug was caused by not switching over early enough.
  • Loading branch information
timmahrt committed Oct 29, 2016
1 parent 5914510 commit 7e7a672
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lmeds/lmeds_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def run(self, cgiForm=None):

# Extract the information from the form
else:
formTuple = self.processForm(cgiForm, self.testSequence)
formTuple = self.processForm(cgiForm)
pageNum, cookieTracker, page, userName = formTuple

self.buildPage(pageNum, cookieTracker, page, userName,
Expand All @@ -114,7 +114,7 @@ def runDebug(self, page, pageNum=1, cookieTracker=True,
self.buildPage(pageNum, cookieTracker, page, userName,
testSequence, self.sourceCGIFN)

def processForm(self, form, testSequence):
def processForm(self, form):
'''
Get page number + user info from previous page; serialize user data
'''
Expand All @@ -125,13 +125,12 @@ def processForm(self, form, testSequence):
cookieTracker += 1

pageNum = int(form["pageNumber"].value)
lastPage = self.testSequence.getPage(pageNum)
lastPageNum = pageNum

# This is the default next page, but in the code below we will see
# if we need to override that decision
pageNum += 1
sequenceTitle = testSequence.sequenceTitle
sequenceTitle = self.testSequence.sequenceTitle
nextPage = None

# If a user name text control is on the page,
Expand Down Expand Up @@ -174,6 +173,10 @@ def processForm(self, form, testSequence):
elif "user_name" in form:
userName = utils.decodeUnicode(form["user_name"].value)
self._testSequenceOverride(userName)

# Get last page info
lastPage = self.testSequence.getPage(lastPageNum)
sequenceTitle = self.testSequence.sequenceTitle

# Serialize all variables
self.serializeResults(form, lastPage, lastPageNum,
Expand Down

0 comments on commit 7e7a672

Please sign in to comment.