#from otree.api import Currency as c, currency_range #from ._builtin import Page, WaitPage #from .models import Constants from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants from otree.models import Participant import csv class Part1PlayDG1(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG1'] form_model = 'player' form_fields = ['decision_1'] def before_next_page(self): self.participant.vars['DG_dec1'] = self.player.decision_1 self.player.part_label = str(self.participant.label) class Part1PlayDG2(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG2'] form_model = 'player' form_fields = ['decision_2'] def before_next_page(self): self.participant.vars['DG_dec2'] = self.player.decision_2 class Part1PlayDG3(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG3'] form_model = 'player' form_fields = ['decision_3'] def before_next_page(self): self.participant.vars['DG_dec3'] = self.player.decision_3 class Part1PlayDG4(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG4'] form_model = 'player' form_fields = ['decision_4'] def before_next_page(self): self.participant.vars['DG_dec4'] = self.player.decision_4 class Part1PlayDG5(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG5'] form_model = 'player' form_fields = ['decision_5'] def before_next_page(self): self.participant.vars['DG_dec5'] = self.player.decision_5 class Part1PlayDG6(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG6'] form_model = 'player' form_fields = ['decision_6'] def before_next_page(self): self.participant.vars['DG_dec6'] = self.player.decision_6 class Part1PlayDG7(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG7'] form_model = 'player' form_fields = ['decision_7'] def before_next_page(self): self.participant.vars['DG_dec7'] = self.player.decision_7 class Part1PlayDG8(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG8'] form_model = 'player' form_fields = ['decision_8'] def before_next_page(self): self.participant.vars['DG_dec8'] = self.player.decision_8 class Part1PlayDG9(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG9'] form_model = 'player' form_fields = ['decision_9'] def before_next_page(self): self.participant.vars['DG_dec9'] = self.player.decision_9 class Part1PlayDG10(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG10'] form_model = 'player' form_fields = ['decision_10'] def before_next_page(self): self.participant.vars['DG_dec10'] = self.player.decision_10 class Part1PlayDG11(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG11'] form_model = 'player' form_fields = ['decision_11'] def before_next_page(self): self.participant.vars['DG_dec11'] = self.player.decision_11 class Part1PlayDG12(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG12'] form_model = 'player' form_fields = ['decision_12'] def before_next_page(self): self.participant.vars['DG_dec12'] = self.player.decision_12 class Part1PlayDG13(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG13'] form_model = 'player' form_fields = ['decision_13'] def before_next_page(self): self.participant.vars['DG_dec13'] = self.player.decision_13 class Part1PlayDG14(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG14'] form_model = 'player' form_fields = ['decision_14'] def before_next_page(self): self.participant.vars['DG_dec14'] = self.player.decision_14 class Part1PlayDG15(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG15'] form_model = 'player' form_fields = ['decision_15'] def before_next_page(self): self.participant.vars['DG_dec15'] = self.player.decision_15 class Part1PlayDG16(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG16'] form_model = 'player' form_fields = ['decision_16'] def before_next_page(self): self.participant.vars['DG_dec16'] = self.player.decision_16 class Part1PlayDG17(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG17'] form_model = 'player' form_fields = ['decision_17'] def before_next_page(self): self.participant.vars['DG_dec17'] = self.player.decision_17 class Part1PlayDG18(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG18'] form_model = 'player' form_fields = ['decision_18'] def before_next_page(self): self.participant.vars['DG_dec18'] = self.player.decision_18 class Part1PlayDG19(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG19'] form_model = 'player' form_fields = ['decision_19'] def before_next_page(self): self.participant.vars['DG_dec19'] = self.player.decision_19 class Part1PlayDG20(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG20'] form_model = 'player' form_fields = ['decision_20'] def before_next_page(self): self.participant.vars['DG_dec20'] = self.player.decision_20 class Part1PlayDG21(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG21'] form_model = 'player' form_fields = ['decision_21'] def before_next_page(self): self.participant.vars['DG_dec21'] = self.player.decision_21 class Part1PlayDG22(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG22'] form_model = 'player' form_fields = ['decision_22'] def before_next_page(self): self.participant.vars['DG_dec22'] = self.player.decision_22 class Part1PlayDG23(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG23'] form_model = 'player' form_fields = ['decision_23'] def before_next_page(self): self.participant.vars['DG_dec23'] = self.player.decision_23 class Part1PlayDG24(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG24'] form_model = 'player' form_fields = ['decision_24'] def before_next_page(self): self.participant.vars['DG_dec24'] = self.player.decision_24 class Part1PlayDG25(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG25'] form_model = 'player' form_fields = ['decision_25'] def before_next_page(self): self.participant.vars['DG_dec25'] = self.player.decision_25 class Part1PlayDG26(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG26'] form_model = 'player' form_fields = ['decision_26'] def before_next_page(self): self.participant.vars['DG_dec26'] = self.player.decision_26 class Part1PlayDG27(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG27'] form_model = 'player' form_fields = ['decision_27'] def before_next_page(self): self.participant.vars['DG_dec27'] = self.player.decision_27 class Part1PlayDG28(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG28'] form_model = 'player' form_fields = ['decision_28'] def before_next_page(self): self.participant.vars['DG_dec28'] = self.player.decision_28 class Part1PlayDG29(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG29'] form_model = 'player' form_fields = ['decision_29'] def before_next_page(self): self.participant.vars['DG_dec29'] = self.player.decision_29 class Part1PlayDG30(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG30'] form_model = 'player' form_fields = ['decision_30'] def before_next_page(self): self.participant.vars['DG_dec30'] = self.player.decision_30 class Part1PlayDG31(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG31'] form_model = 'player' form_fields = ['decision_31'] def before_next_page(self): self.participant.vars['DG_dec31'] = self.player.decision_31 class Part1PlayDG32(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG32'] form_model = 'player' form_fields = ['decision_32'] def before_next_page(self): self.participant.vars['DG_dec32'] = self.player.decision_32 class Part1PlayDG33(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG33'] form_model = 'player' form_fields = ['decision_33'] def before_next_page(self): self.participant.vars['DG_dec33'] = self.player.decision_33 class Part1PlayDG34(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG34'] form_model = 'player' form_fields = ['decision_34'] def before_next_page(self): self.participant.vars['DG_dec34'] = self.player.decision_34 class Part1PlayDG35(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG35'] form_model = 'player' form_fields = ['decision_35'] def before_next_page(self): self.participant.vars['DG_dec35'] = self.player.decision_35 class Part1PlayDG36(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG36'] form_model = 'player' form_fields = ['decision_36'] def before_next_page(self): self.participant.vars['DG_dec36'] = self.player.decision_36 class Part1PlayDG37(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG37'] form_model = 'player' form_fields = ['decision_37'] def before_next_page(self): self.participant.vars['DG_dec37'] = self.player.decision_37 class Part1PlayDG38(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG38'] form_model = 'player' form_fields = ['decision_38'] def before_next_page(self): self.participant.vars['DG_dec38'] = self.player.decision_38 class Part1PlayDG39(Page): def is_displayed(self): return self.round_number == self.participant.vars['task_rounds']['DG39'] form_model = 'player' form_fields = ['decision_39'] def before_next_page(self): self.participant.vars['DG_dec39'] = self.player.decision_39 # class End(Page): # def is_displayed(self): # return self.round_number == Constants.num_rounds # # def before_next_page(self): # self.participant.vars['part_label'] = str(self.participant.label) # self.player.part_label = str(self.participant.label) # # ps = Participant.objects.all() # all_participant_vars = [p.vars for p in ps] # all_participant_codes = [{'participant_code': p.code, 'session_code': p.session.code} for p in ps] # # for i in range(0, len(all_participant_vars)): # all_participant_vars[i].update(all_participant_codes[i]) # # csv_columns = ['DG_dec1', 'DG_dec2', 'DG_dec3', 'DG_dec4', 'DG_dec5', 'part_label', 'label'] # # with open('survey_draft1b/part_vars_DGplay.csv', 'w') as csvfile: # writer = csv.DictWriter(csvfile, fieldnames=csv_columns, extrasaction='ignore') # writer.writeheader() # for data in all_participant_vars: # writer.writerow(data) page_sequence = [ Part1PlayDG1, Part1PlayDG2, Part1PlayDG3, Part1PlayDG4, Part1PlayDG5, Part1PlayDG6, Part1PlayDG7, Part1PlayDG8, Part1PlayDG9, Part1PlayDG10, Part1PlayDG11, Part1PlayDG12, Part1PlayDG13, Part1PlayDG14, Part1PlayDG15, Part1PlayDG16, Part1PlayDG17, Part1PlayDG18, Part1PlayDG19, Part1PlayDG20, Part1PlayDG21, Part1PlayDG22, Part1PlayDG23, Part1PlayDG24, Part1PlayDG25, Part1PlayDG26, Part1PlayDG27, Part1PlayDG28, Part1PlayDG29, Part1PlayDG30, Part1PlayDG31, Part1PlayDG32, Part1PlayDG33, Part1PlayDG34, Part1PlayDG35, Part1PlayDG36, Part1PlayDG37, Part1PlayDG38, Part1PlayDG39 #End ] #class MyPage(Page): # pass #class ResultsWaitPage(WaitPage): # def after_all_players_arrive(self): # pass #class Results(Page): # pass #page_sequence = [MyPage, ResultsWaitPage, Results]