def enter_rep_expt(): survey_code = request.args.get('survey_code') if survey_code == None: return render_template( 'error-page.html', error= "Please supply a survey code if you want to proceed with REP mode") custom_attrs = {'REP': True, 'survey_code': survey_code} # Record particpant starting experiment (uid, error) = me_expt.create_unique_participant(request, expt_uid=expt_uid, custom_attrs=custom_attrs, debug=DEBUG) if error: return render_template(error['template'], **error) data = me_expt.check_set_participant_attrs(uid, get_data(request.args), DEBUG) if data.get('_error') != None: return render_template('error-page.html', error=data['_error']) return render_template( 'exp.html', uid=uid, rep=1, survey_code=survey_code, rep_on_consent=int( config.REP_ON_CONSENT ), # converting python boolean to integer to avoid ambiguity data=json.dumps(data))
def rep_start_expt(): if not 'uid' in request.args: raise Exception("Unique ID not provided") uid = request.args['uid'] if 'email' in request.args and not DEBUG: me_expt.set_participant_attrs(uid, {'email': request.args['email']}) data = me_expt.check_set_participant_attrs(uid, get_data(request.args), DEBUG) return render_template('exp.html', uid=uid, rep=1, data=json.dumps(data))
def unique_start_exp(): # Record particpant starting experiment (uid, error) = me_expt.create_unique_participant(request, expt_uid=expt_uid, debug=DEBUG) if error: return render_template(error['template'], **error) data = me_expt.check_set_participant_attrs(uid, get_data(request.args), DEBUG) if data.get('_error') != None: return render_template('error-page.html', error=data['_error']) return render_template('exp.html', uid=uid, data=json.dumps(data))
def mturk_start_exp(): if not 'workerId' in request.args: raise Exception("Unique ID not provided") # Record particpant starting experiment (uid, error) = me_expt.start_mturk_expt(request, expt_uid=expt_uid, debug=DEBUG) if error: print(error) return render_template(error['template'], **error) data = me_expt.check_set_participant_attrs(uid, get_data(request.args), DEBUG) if data.get('_error') != None: return render_template('error-page.html', error=data['_error']) return render_template('exp.html', uid=uid, data=json.dumps(data))