from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class FinishPage(Page): def before_next_page(self): player = self.player try: player.interruptionsFlag = player.participant.vars['interruptionsFlag'] except: player.interruptionsFlag = 1 import random player.paymentSchemeFlag = random.randint(1,2) player.showFeedbackFlag = random.randint(0,1) player.pullAmountFeedback = random.choice([0.05, 0.15, 0.25, 0.50, 0.75, 1.0, 1.5, 2.0,3.0,5.0,8.0]) player.pullAmountWTP = random.choice([0.05,0.1,0.15,0.2,0.25,0.3,0.4,0.5,0.75,1.0,1.25,1.5,2.0,3.0,5.0,8.0]) player.participant.vars['AgreedFeedbackAmounts'] = [] player.participant.vars['AgreedWTPAmounts'] = [] player.participant.vars['secondList'] = list(range(181, 226)) player.participant.vars['emailMessages'] = ['Please confirm that you are still working by replying', 'Please confirm that you are making progress by replying', 'Please confirm that you are currently transcribing barcodes by replying', 'Please confirm that you are in front of a PC/laptop/tablet/phone by replying'] player.participant.vars['emailResponse'] = ["Certain", "Sure", "True", "Right"] player.barcodesInterval1 = player.participant.vars["barcodesInterval1"] player.barcodesInterval2 = player.participant.vars["barcodesInterval2"] player.barcodesInterval3 = player.participant.vars["barcodesInterval3"] player.barcodesInterval4 = player.participant.vars["barcodesInterval4"] player.barcodesInterval5 = player.participant.vars["barcodesInterval5"] player.barcodesInterval6 = player.participant.vars["barcodesInterval6"] player.barcodesFirst30Mins = player.barcodesInterval1+player.barcodesInterval2+player.barcodesInterval3 player.barcodesLast30Mins = player.barcodesInterval4 + player.barcodesInterval5 + player.barcodesInterval6 try: player.errorRateInterval1 = round( (player.participant.vars["errorInterval1"]/(player.barcodesInterval1*40)) *100 ,2) except: player.errorRateInterval1 = 0 try: player.errorRateInterval2 = round( (player.participant.vars["errorInterval2"]/(player.barcodesInterval2*40)) *100 ,2) except: player.errorRateInterval2 = 0 try: player.errorRateInterval3 = round( (player.participant.vars["errorInterval3"]/(player.barcodesInterval3*40)) *100 ,2) except: player.errorRateInterval3 = 0 try: player.errorRateInterval4 = round( (player.participant.vars["errorInterval4"]/(player.barcodesInterval4*40)) *100 ,2) except: player.errorRateInterval4 = 0 try: player.errorRateInterval5 = round( (player.participant.vars["errorInterval5"]/(player.barcodesInterval5*40)) *100 ,2) except: player.errorRateInterval5 = 0 try: player.errorRateInterval6 = round( (player.participant.vars["errorInterval6"]/(player.barcodesInterval6*40)) *100 ,2) except: player.errorRateInterval6 = 0 errorFirst30 = player.participant.vars["errorInterval1"] + player.participant.vars["errorInterval2"] + player.participant.vars["errorInterval3"] errorLast30 = player.participant.vars["errorInterval4"] + player.participant.vars["errorInterval5"] + player.participant.vars["errorInterval6"] correctFirst30 = player.participant.vars["correctInterval1"] + player.participant.vars["correctInterval2"] + player.participant.vars["correctInterval3"] correctLast30 = player.participant.vars["correctInterval4"] + player.participant.vars["correctInterval5"] + player.participant.vars["correctInterval6"] try: player.errorRateFirst30Mins = round((errorFirst30/(player.barcodesFirst30Mins*40)) * 100, 2) except: player.errorRateFirst30Mins = 0 try: player.errorRateLast30Mins = round((errorLast30/(player.barcodesLast30Mins*40)) * 100, 2) except: player.errorRateLast30Mins = 0 if player.participant.vars['whichHalf'] == 1: player.barcodesWithInterruptions = player.barcodesFirst30Mins player.barcodesWithoutInterruptions = player.barcodesLast30Mins player.errorRateWithInterruptions = player.errorRateFirst30Mins player.errorRateWithoutInterruptions = player.errorRateLast30Mins player.errorsWithInterruptions = player.participant.vars['mistakesTallyFirst'] player.errorsWithoutInterruptions = player.participant.vars['mistakesTallyLast'] player.correctsWithInterruptions = player.participant.vars['correctsTallyFirst'] player.correctsWithoutInterruptions = player.participant.vars['correctsTallyLast'] else: player.barcodesWithoutInterruptions = player.barcodesFirst30Mins player.barcodesWithInterruptions = player.barcodesLast30Mins player.errorRateWithoutInterruptions = player.errorRateFirst30Mins player.errorRateWithInterruptions = player.errorRateLast30Mins player.errorsWithoutInterruptions = player.participant.vars['mistakesTallyFirst'] player.errorsWithInterruptions = player.participant.vars['mistakesTallyLast'] player.correctsWithoutInterruptions = player.participant.vars['correctsTallyFirst'] player.correctsWithInterruptions = player.participant.vars['correctsTallyLast'] player.earningFromTask = player.participant.vars['earningFromTask'] import time player.timeOnPostBelief1 = time.time() unit = 60 a = random.randint((unit * 3), (unit * 7)) b = random.randint((unit * 8), (unit * 12)) player.participant.vars['ipts_list_second'] = [a, b] ''' player.barcodesInterval1 = 10 player.barcodesInterval2 = 10 player.barcodesInterval3 = 10 player.barcodesInterval4 = 10 player.barcodesInterval5 = 10 player.barcodesInterval6 = 20 player.barcodesFirst30Mins = player.barcodesInterval1+player.barcodesInterval2+player.barcodesInterval3 player.barcodesLast30Mins = player.barcodesInterval4 + player.barcodesInterval5 + player.barcodesInterval6 player.participant.vars['whichHalf'] = 2 player.participant.vars['earningFromInterruptions'] = 0 player.errorRateInterval1 = 50 player.errorRateInterval2 = 50 player.errorRateInterval3 = 50 player.errorRateInterval4 = 50 player.errorRateInterval5 = 50 player.errorRateInterval6 = 50 player.errorRateFirst30Mins = 70 player.errorRateLast30Mins = 140 if player.participant.vars['whichHalf'] == 1: player.barcodesWithInterruptions = player.barcodesFirst30Mins player.barcodesWithoutInterruptions = player.barcodesLast30Mins player.errorRateWithInterruptions = player.errorRateFirst30Mins player.errorRateWithoutInterruptions = player.errorRateLast30Mins player.errorsWithInterruptions = 10 player.errorsWithoutInterruptions = 10 player.correctsWithInterruptions = 10 player.correctsWithoutInterruptions = 10 else: player.barcodesWithoutInterruptions = player.barcodesFirst30Mins player.barcodesWithInterruptions = player.barcodesLast30Mins player.errorRateWithoutInterruptions = player.errorRateFirst30Mins player.errorRateWithInterruptions = player.errorRateLast30Mins player.errorsWithoutInterruptions = 20 player.errorsWithInterruptions = 20 player.correctsWithoutInterruptions = 20 player.correctsWithInterruptions = 20 player.earningFromTask = 60 import time player.timeOnPostBelief1 = time.time() ''' class PostBeliefsPage1(Page): form_model = 'player' form_fields = ['postbeliefp1q1', 'postbeliefp1q2','postbeliefp1q3', 'postbeliefp1q4','postbeliefp1q5','postbeliefp1q6', 'postbeliefp1q7', 'postbeliefp1q8', 'postbeliefp1q9', 'postbeliefp1q10', 'postbeliefp1q11', 'postbeliefp1q12'] def vars_for_template(self): player = self.player top = "without" bottom = "without" if player.participant.vars['whichHalf'] == 1: if player.interruptionsFlag == 1: top = 'with email' else: top = 'with proofreading' else: if player.interruptionsFlag == 1: bottom = 'with email' else: bottom = 'with proofreading' return dict( top=top, bottom=bottom ) def before_next_page(self): player = self.player import time player.timeOnPostBelief1 = round(time.time() - player.timeOnPostBelief1,2) try: bonus1 = 0.25 - ((1 - player.postbeliefp1q1 / player.barcodesInterval1)**2) except: bonus1 =0 if bonus1 < 0: bonus1 = 0 try: bonus2 = 0.25 - ((1 - player.postbeliefp1q2 / player.barcodesInterval2)**2) except: bonus2 =0 if bonus2 < 0: bonus2 = 0 try: bonus3 = 0.25 - ((1 - player.postbeliefp1q3 / player.barcodesInterval3)**2) except: bonus3 =0 if bonus3 < 0: bonus3 = 0 try: bonus4 = 0.25 - ((1 - player.postbeliefp1q4 / player.barcodesInterval4)**2) except: bonus4 =0 if bonus4 < 0: bonus4 = 0 try: bonus5 = 0.25 - ((1 - player.postbeliefp1q5 / player.barcodesInterval5)**2) except: bonus5 =0 if bonus5 < 0: bonus5 = 0 try: bonus6 = 0.25 - ((1 - player.postbeliefp1q6 / player.barcodesInterval6)**2) except: bonus6 =0 if bonus6 < 0: bonus6 = 0 try: bonus7 = 0.25 - ((1 - player.postbeliefp1q7 / player.errorRateInterval1)**2) except: bonus7 =0 if bonus7 < 0: bonus7 = 0 try: bonus8 = 0.25 - ((1 - player.postbeliefp1q8 / player.errorRateInterval2)**2) except: bonus8 =0 if bonus8 < 0: bonus8 = 0 try: bonus9 = 0.25 - ((1 - player.postbeliefp1q9 / player.errorRateInterval3)**2) except: bonus9 =0 if bonus9 < 0: bonus9 = 0 try: bonus10 = 0.25 - ((1 - player.postbeliefp1q10 / player.errorRateInterval4)**2) except: bonus10 =0 if bonus10 < 0: bonus10 = 0 try: bonus11 = 0.25 - ((1 - player.postbeliefp1q11 / player.errorRateInterval5)**2) except: bonus11 =0 if bonus11 < 0: bonus11 = 0 try: bonus12 = 0.25 - ((1 - player.postbeliefp1q12 / player.errorRateInterval6)**2) except: bonus12 =0 if bonus12 < 0: bonus12 = 0 player.bonusFromPostBelief = bonus1 + bonus2 + bonus3 + bonus4 + bonus5 + bonus6\ + bonus7 + bonus8 + bonus9 + bonus10 + bonus11 + bonus12 player.bonusFromPostBelief = round(player.bonusFromPostBelief, 2) player.earnedAmount += player.bonusFromPostBelief player.timeOnPostBelief2 = time.time() class PostBeliefsPage2(Page): form_model = 'player' form_fields = ['postbeliefp2q1', 'postbeliefp2q2','postbeliefp2q3', 'postbeliefp2q4','postbeliefp2q5','postbeliefp2q6', 'postbeliefp2q7', 'postbeliefp2q8', 'postbeliefp2q9', 'postbeliefp2q10', 'postbeliefp2q11', 'postbeliefp2q12', 'postbeliefp2q13', 'postbeliefp2q14', 'postbeliefp2q15', 'postbeliefp2q23', 'postbeliefp2q24', 'postbeliefp2q16', 'postbeliefp2q17', 'postbeliefp2q18', 'postbeliefp2q19', 'postbeliefp2q20', 'postbeliefp2q21', 'postbeliefp2q22'] # saray hain ismay def vars_for_template(self): player = self.player top = "without" bottom = "without" if player.participant.vars['whichHalf'] == 1: if player.interruptionsFlag == 1: top = 'with email' else: top = 'with proofreading' else: if player.interruptionsFlag == 1: bottom = 'with email' else: bottom = 'with proofreading' return dict( top=top, bottom=bottom ) @staticmethod def error_message(values): if (values["postbeliefp2q1"] > values["postbeliefp2q4"]) or\ (values["postbeliefp2q2"] > values["postbeliefp2q5"]) or\ (values["postbeliefp2q3"] > values["postbeliefp2q6"]) or\ \ (values["postbeliefp2q13"] > values["postbeliefp2q16"]) or\ (values["postbeliefp2q14"] > values["postbeliefp2q17"]) or\ (values["postbeliefp2q15"] > values["postbeliefp2q18"]): return "Minimum barcodes cannot be higher than maximum barcodes" @staticmethod def error_message(values): if (values["postbeliefp2q7"] > values["postbeliefp2q10"]) or\ (values["postbeliefp2q8"] > values["postbeliefp2q11"]) or\ (values["postbeliefp2q9"] > values["postbeliefp2q12"]) or\ \ (values["postbeliefp2q19"] > values["postbeliefp2q22"]) or\ (values["postbeliefp2q20"] > values["postbeliefp2q23"]) or\ (values["postbeliefp2q21"] > values["postbeliefp2q24"]): return "Minimum error rate cannot be higher than maximum error rate" def before_next_page(self): player = self.player import time player.timeOnPostBelief2 = round(time.time() - player.timeOnPostBelief2,2) player.timeOnWTP1 = time.time() class WTP1(Page): def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email' title2 = 'emails' else: title = "proofreading" title2 = "proofreading request" return dict( title=title, title2=title2 ) def before_next_page(self): player = self.player import time player.timeOnWTP1 = round(time.time() - player.timeOnWTP1,2) if player.showFeedbackFlag == 1: player.timeOnFeedback1 = time.time() class Feedback1(Page): def is_displayed(self): player =self.player return player.showFeedbackFlag == 1 def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email' else: title = "proofreading" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnFeedback1 = round(time.time() - player.timeOnFeedback1,2) player.timeOnFeedback2 = time.time() class Feedback2(Page): form_model = 'player' form_fields = ['feedback2'] def is_displayed(self): player =self.player return player.showFeedbackFlag == 1 def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email' else: title = "proofreading" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnFeedback2 = round(time.time() - player.timeOnFeedback2,2) player.timeOnFeedback3 = time.time() if player.feedback2 == 'Yes': player.participant.vars['AgreedFeedbackAmounts'].append(0.05) class Feedback3(Page): form_model = 'player' form_fields = ['feedback3'] def is_displayed(self): player =self.player return player.showFeedbackFlag == 1 def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email' else: title = "proofreading" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnFeedback3 = round(time.time() - player.timeOnFeedback3,2) player.timeOnFeedback4 = time.time() if player.feedback3 == 'Yes': player.participant.vars['AgreedFeedbackAmounts'].append(0.15) class Feedback4(Page): form_model = 'player' form_fields = ['feedback4'] def is_displayed(self): player =self.player return player.showFeedbackFlag == 1 def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email' else: title = "proofreading" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnFeedback4 = round(time.time() - player.timeOnFeedback4,2) player.timeOnFeedback5 = time.time() if player.feedback4 == 'Yes': player.participant.vars['AgreedFeedbackAmounts'].append(0.25) class Feedback5(Page): form_model = 'player' form_fields = ['feedback5'] def is_displayed(self): player =self.player return player.showFeedbackFlag == 1 def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email' else: title = "proofreading" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnFeedback5 = round(time.time() - player.timeOnFeedback5,2) player.timeOnFeedback6 = time.time() if player.feedback5 == 'Yes': player.participant.vars['AgreedFeedbackAmounts'].append(0.5) class Feedback6(Page): form_model = 'player' form_fields = ['feedback6'] def is_displayed(self): player =self.player return player.showFeedbackFlag == 1 def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email' else: title = "proofreading" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnFeedback6 = round(time.time() - player.timeOnFeedback6,2) player.timeOnFeedback7 = time.time() if player.feedback6 == 'Yes': player.participant.vars['AgreedFeedbackAmounts'].append(0.75) class Feedback7(Page): form_model = 'player' form_fields = ['feedback7'] def is_displayed(self): player =self.player return player.showFeedbackFlag == 1 def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email' else: title = "proofreading" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnFeedback7 = round(time.time() - player.timeOnFeedback7,2) player.timeOnFeedback8 = time.time() if player.feedback7 == 'Yes': player.participant.vars['AgreedFeedbackAmounts'].append(1.0) class Feedback8(Page): form_model = 'player' form_fields = ['feedback8'] def is_displayed(self): player =self.player return player.showFeedbackFlag == 1 def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email' else: title = "proofreading" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnFeedback8 = round(time.time() - player.timeOnFeedback8,2) player.timeOnFeedback9 = time.time() if player.feedback8 == 'Yes': player.participant.vars['AgreedFeedbackAmounts'].append(1.5) class Feedback9(Page): form_model = 'player' form_fields = ['feedback9'] def is_displayed(self): player =self.player return player.showFeedbackFlag == 1 def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email' else: title = "proofreading" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnFeedback9 = round(time.time() - player.timeOnFeedback9,2) player.timeOnFeedback10 = time.time() if player.feedback9 == 'Yes': player.participant.vars['AgreedFeedbackAmounts'].append(2.0) class Feedback10(Page): form_model = 'player' form_fields = ['feedback10'] def is_displayed(self): player =self.player return player.showFeedbackFlag == 1 def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email' else: title = "proofreading" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnFeedback10 = round(time.time() - player.timeOnFeedback10,2) player.timeOnFeedback11 = time.time() if player.feedback10 == 'Yes': player.participant.vars['AgreedFeedbackAmounts'].append(3.0) class Feedback11(Page): form_model = 'player' form_fields = ['feedback11'] def is_displayed(self): player =self.player return player.showFeedbackFlag == 1 def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email' else: title = "proofreading" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnFeedback11 = round(time.time() - player.timeOnFeedback11,2) player.timeOnFeedback12 = time.time() if player.feedback11 == 'Yes': player.participant.vars['AgreedFeedbackAmounts'].append(5.0) class Feedback12(Page): form_model = 'player' form_fields = ['feedback12'] def is_displayed(self): player =self.player return player.showFeedbackFlag == 1 def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email' else: title = "proofreading" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnFeedback12 = round(time.time() - player.timeOnFeedback12,2) player.timeOnFeedback13 = time.time() if player.feedback12 == 'Yes': player.participant.vars['AgreedFeedbackAmounts'].append(8.0) class Feedback13yes(Page): def is_displayed(self): player =self.player con = (player.showFeedbackFlag == 1) and (player.pullAmountFeedback in player.participant.vars['AgreedFeedbackAmounts']) return con def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email' else: title = "proofreading" return dict( title=title, pull_amount = player.pullAmountFeedback, pull_number_without= player.barcodesWithoutInterruptions, pull_number_with=player.barcodesWithInterruptions, pull_error_rate_without=player.errorRateWithoutInterruptions, pull_error_rate_with=player.errorRateWithInterruptions ) def before_next_page(self): player = self.player import time player.timeOnFeedback13 = round(time.time() - player.timeOnFeedback13,2) player.timeOnWTP2 = time.time() con = (player.showFeedbackFlag == 1) and (player.pullAmountFeedback in player.participant.vars['AgreedFeedbackAmounts']) if con: player.earnedAmount = player.earnedAmount - player.pullAmountFeedback class Feedback13no(Page): def is_displayed(self): player =self.player con = (player.showFeedbackFlag == 1) and (player.pullAmountFeedback not in player.participant.vars['AgreedFeedbackAmounts']) return con def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email' else: title = "proofreading" return dict( title=title, pull_amount = player.pullAmountFeedback ) def before_next_page(self): player = self.player import time player.timeOnFeedback13 = round(time.time() - player.timeOnFeedback13,2) player.timeOnWTP2 = time.time() class Feedback14(Page): form_model = 'player' form_fields = ['fq1','fq2','fq3','fq4','fq5','fq6'] def is_displayed(self): player =self.player return player.showFeedbackFlag == 1 class WTP2(Page): form_model = 'player' form_fields = ['wtp2'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP2 = round(time.time() - player.timeOnWTP2,2) player.timeOnWTP3 = time.time() if player.wtp2 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(0.05) class WTP3(Page): form_model = 'player' form_fields = ['wtp3'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP3 = round(time.time() - player.timeOnWTP3,2) player.timeOnWTP4 = time.time() if player.wtp3 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(0.1) class WTP4(Page): form_model = 'player' form_fields = ['wtp4'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP4 = round(time.time() - player.timeOnWTP4,2) player.timeOnWTP5 = time.time() if player.wtp4 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(0.15) class WTP5(Page): form_model = 'player' form_fields = ['wtp5'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP5 = round(time.time() - player.timeOnWTP5,2) player.timeOnWTP6 = time.time() if player.wtp5 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(0.2) class WTP6(Page): form_model = 'player' form_fields = ['wtp6'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP6 = round(time.time() - player.timeOnWTP6,2) player.timeOnWTP7 = time.time() if player.wtp6 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(0.25) class WTP7(Page): form_model = 'player' form_fields = ['wtp7'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP7 = round(time.time() - player.timeOnWTP7,2) player.timeOnWTP8 = time.time() if player.wtp7 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(0.3) class WTP8(Page): form_model = 'player' form_fields = ['wtp8'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP8 = round(time.time() - player.timeOnWTP8,2) player.timeOnWTP9 = time.time() if player.wtp8 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(0.4) class WTP9(Page): form_model = 'player' form_fields = ['wtp9'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP9 = round(time.time() - player.timeOnWTP9,2) player.timeOnWTP10 = time.time() if player.wtp9 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(0.5) class WTP10(Page): form_model = 'player' form_fields = ['wtp10'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP10 = round(time.time() - player.timeOnWTP10,2) player.timeOnWTP11 = time.time() if player.wtp10 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(0.75) class WTP11(Page): form_model = 'player' form_fields = ['wtp11'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP11 = round(time.time() - player.timeOnWTP11,2) player.timeOnWTP12 = time.time() if player.wtp11 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(1.0) class WTP12(Page): form_model = 'player' form_fields = ['wtp12'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP12 = round(time.time() - player.timeOnWTP12,2) player.timeOnWTP13 = time.time() if player.wtp12 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(1.25) class WTP13(Page): form_model = 'player' form_fields = ['wtp13'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP13 = round(time.time() - player.timeOnWTP13,2) player.timeOnWTP14 = time.time() if player.wtp13 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(1.5) class WTP14(Page): form_model = 'player' form_fields = ['wtp14'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP14 = round(time.time() - player.timeOnWTP14,2) player.timeOnWTP15 = time.time() if player.wtp14 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(2.0) class WTP15(Page): form_model = 'player' form_fields = ['wtp15'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP15 = round(time.time() - player.timeOnWTP15,2) player.timeOnWTP16 = time.time() if player.wtp15 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(3.0) class WTP16(Page): form_model = 'player' form_fields = ['wtp16'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP16 = round(time.time() - player.timeOnWTP16,2) player.timeOnWTP17 = time.time() if player.wtp16 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(5.0) class WTP17(Page): form_model = 'player' form_fields = ['wtp17'] def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'email interruptions' else: title = "proofreading requests" return dict( title=title ) def before_next_page(self): player = self.player import time player.timeOnWTP17 = round(time.time() - player.timeOnWTP17,2) player.timeOnWTP18 = time.time() if player.wtp17 == 'Yes': player.participant.vars['AgreedWTPAmounts'].append(8.0) class WTPyes(Page): def is_displayed(self): player =self.player con = (player.pullAmountWTP in player.participant.vars['AgreedWTPAmounts']) return con def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'emails' else: title = "proofreading requests" return dict( title=title, pull_amount = player.pullAmountWTP ) def before_next_page(self): player = self.player import time player.timeOnWTP18 = round(time.time() - player.timeOnWTP18,2) player.earnedAmount = round(player.earnedAmount - player.pullAmountWTP, 3) if (player.pullAmountWTP in player.participant.vars['AgreedWTPAmounts']): player.participant.vars['showInterruptionsInTask2'] = 'No' player.participant.vars['extraDurationInTask2'] = 0 else: player.participant.vars['showInterruptionsInTask2'] = 'Yes' player.participant.vars['extraDurationInTask2'] = 60 class WTPno(Page): def is_displayed(self): player =self.player con = (player.pullAmountWTP not in player.participant.vars['AgreedWTPAmounts']) return con def vars_for_template(self): player = self.player if player.interruptionsFlag == 1: title = 'emails' else: title = "proofreading requests" return dict( title=title, pull_amount = player.pullAmountWTP ) def before_next_page(self): player = self.player import time player.timeOnWTP18 = round(time.time() - player.timeOnWTP18,2) if (player.pullAmountWTP in player.participant.vars['AgreedWTPAmounts']): player.participant.vars['showInterruptionsInTask2'] = 'No' player.participant.vars['extraDurationInTask2'] = 0 else: player.participant.vars['showInterruptionsInTask2'] = 'Yes' player.participant.vars['extraDurationInTask2'] = 60 class WTP18(Page): form_model = 'player' form_fields = ['wq1','wq2','wq3','wq4','wq5','wq6'] class HeadsUp(Page): def before_next_page(self): player = self.player player.earningWithInterruptions = (player.correctsWithInterruptions * Constants.piece_rate)\ - (player.errorsWithInterruptions * Constants.penalty_rate) player.earningWithoutInterruptions = (player.correctsWithoutInterruptions * Constants.piece_rate)\ - (player.errorsWithoutInterruptions * Constants.penalty_rate) player.chosenEarning = round(player.earningWithInterruptions + player.earningWithoutInterruptions,2) player.earnedAmount += player.chosenEarning if player.participant.vars['earningFromInterruptions'] == 4: player.earnedAmount += 0.5 else: pen = (4 - player.participant.vars['earningFromInterruptions'])*0.5 player.earnedAmount = player.earnedAmount - pen player.participant.vars['earnedAmount'] = player.earnedAmount page_sequence = [FinishPage, PostBeliefsPage1, PostBeliefsPage2, WTP1, Feedback1, Feedback2, Feedback3, Feedback4, Feedback5, Feedback6, Feedback7, Feedback8, Feedback9, Feedback10, Feedback11, Feedback12, Feedback13yes, Feedback13no, Feedback14, WTP2, WTP3, WTP4, WTP5, WTP6, WTP7, WTP8, WTP9, WTP10, WTP11, WTP12, WTP13, WTP14, WTP15, WTP16, WTP17, WTPyes, WTPno, WTP18, HeadsUp]