Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
adding intake surveys to user JSON response
  • Loading branch information
dtraviglia committed May 20, 2016
1 parent 8c1ae0d commit 3a829fdc14302ac384811a1d1fe3c2f4eb7f2a8b
Showing 1 changed file with 14 additions and 3 deletions.
@@ -162,15 +162,26 @@ def view_users_experiment(request, experiment_name):
for userprofile in userprofiles:
tasklistitems = userprofile.tasklistitem_set.all()
completedTasks = [task for task in tasklistitems if task.task_complete is True]

#Mechanical Turk task completion payment code
mtcode = mechanicalTurk.generateCode(userprofile.user.id,userprofile.user_hash)

if userprofile.intake_complete == 1:
session_id = str(userprofile.user_hash)+'::0'

stoutVars = {'SYS.FIL.DAT.':'',
'SYS.FIL.EXP.':SM_EXPERIMENT_NAME,
'SYS.FIL.APP.':'',
'SYS.FIL.TSK.':'INTAKE',
'SYS.FIL.ORD.':'',
'SYS.FIL.STD.':''}
user_hashes[session_id]={'mtcode':mtcode,'vars':stoutVars}
for task in completedTasks:
#unique identifier for user::task
session_id = str(userprofile.user_hash)+'::'+str(task.pk)
#TEST VALUE
#session_id = "49bacc695d39a2f23cf44f949409e7::1104"

#Mechanical Turk task completion payment code
mtcode = mechanicalTurk.generateCode(userprofile.user.id,userprofile.user_hash)

#ALE logged survey start time
XDATA_INDEX="xdata_v3"
es = Elasticsearch(ALE_URL)

0 comments on commit 3a829fd

Please sign in to comment.