from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants ### Testing ### class _testpage(Page): pass ### Vorgeplänkel ### class WaitAndGrouping(WaitPage): # Das will ich noch mehr individualisieren! title_text = "Gleich geht es los!" body_text = "Bitte haben Sie ein wenig Geduld, Sie müssen noch kurz warten bis die anderen Teilnehmer*innen auch so weit sind. Bitte schließen oder minimieren Sie in keinem Fall das Browser-Fenster, sie warten maximal zehn Minuten!" # Leute werden nach arrival_time in Gruppen gesteckt -> Leute die gleichzeitig spielen, sind in einer Gruppe group_by_arrival_time = True #def group_by_arrival_time_method(self, waiting_players): #import time #if len(waiting_players) >= Constants.players_per_group: # return waiting_players[:Constants.players_per_group] #for p in waiting_players: # if time.time() - p.participant.vars['ArrivalTime'] > 1*60: # return [p] #def app_after_this_page(self): #if self.player.Singleplayer == 1: #return "Demographics" # wenn alle Spieler einer Gruppe hier sind, wird für sie eine Bed. gepickt after_all_players_arrive = "condition_picker"# "check_for_timeout" template_name = "global/WaitPage.html" # global WaitPage-template def is_displayed(self): return self.participant.vars["timeout"] == 0 ### Experiment ### class InstructionsGroup(Page): form_model = "player" # timeout timeout_seconds = 600 def is_displayed(self): return self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 #def before_next_page(self): #if self.timeout_happened: #self.participant.vars["timeout"] = 1 #self.player.timeoutProduced = True #else: #pass class InstructionsSingleplayer(Page): form_model = "player" def is_displayed(self): return self.player.Singleplayer == 1 and self.participant.vars["timeout"] == 0 # timeout timeout_seconds = 1200 # Ich war ein bisschen faul: Eigentlich wird condition ja schon gepicked aber für die Singleplayer ist das dann # wie für die Gruppen immer die gleiche... Deswegen wird das hier einfach nochmal überschrieben: def before_next_page(self): import random from operator import itemgetter if self.session.vars["conditionCounterSingleplayer"] == 0: pickedCondition=itemgetter(0)(self.session.vars["conditionsShuffeldSingleplayer"]) self.session.vars["conditionCounterSingleplayer"]+=1 elif self.session.vars["conditionCounterSingleplayer"] == 1: pickedCondition=itemgetter(1)(self.session.vars["conditionsShuffeldSingleplayer"]) self.session.vars["conditionCounterSingleplayer"]+=1 elif self.session.vars["conditionCounterSingleplayer"] == 2: pickedCondition=itemgetter(2)(self.session.vars["conditionsShuffeldSingleplayer"]) self.session.vars["conditionCounterSingleplayer"]+=1 else: pickedCondition=itemgetter(3)(self.session.vars["conditionsShuffeldSingleplayer"]) self.session.vars["conditionCounterSingleplayer"]=0 random.shuffle(self.session.vars["conditionsShuffeldSingleplayer"]) self.player.condition = pickedCondition if self.timeout_happened: self.participant.vars["timeout"] = 1 else: pass class WaitPreSimpson(WaitPage): title_text = "Bitte einen Moment Geduld!" body_text = "Die anderen Teilnehmer*innen sind nicht so schnell wie Sie und lesen noch die Instruktionen. Es wird jeden Moment weiter gehen!" #def after_all_players_arrive(self): #pass template_name = "global/WaitPage.html" # global WaitPage-template def is_displayed(self): return self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 ## Conditions ## class SimpsonCond11(Page): form_model = "player" timer_text = "Verbleibende Zeit:" timeout_seconds = 362 def is_displayed(self): return self.player.condition == "11.02." and self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 class SimpsonCond12(Page): form_model = "player" timer_text = "Verbleibende Zeit:" timeout_seconds = 362 def is_displayed(self): return self.player.condition == "12.02." and self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 class SimpsonCond13(Page): form_model = "player" timer_text = "Verbleibende Zeit:" timeout_seconds = 362 def is_displayed(self): return self.player.condition == "13.02." and self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 class SimpsonCond14(Page): form_model = "player" timer_text = "Verbleibende Zeit:" timeout_seconds = 362 def is_displayed(self): return self.player.condition == "14.02." and self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 class SimpsonCondSingleplayer11(Page): form_model = "player" timer_text = "Verbleibende Zeit:" timeout_seconds = 722 def is_displayed(self): return self.player.condition == "11.02." and self.player.Singleplayer == 1 and self.participant.vars["timeout"] == 0 class SimpsonCondSingleplayer12(Page): form_model = "player" timer_text = "Verbleibende Zeit:" timeout_seconds = 722 def is_displayed(self): return self.player.condition == "12.02." and self.player.Singleplayer == 1 and self.participant.vars["timeout"] == 0 class SimpsonCondSingleplayer13(Page): form_model = "player" timer_text = "Verbleibende Zeit:" timeout_seconds = 722 def is_displayed(self): return self.player.condition == "13.02." and self.player.Singleplayer == 1 and self.participant.vars["timeout"] == 0 class SimpsonCondSingleplayer14(Page): form_model = "player" timer_text = "Verbleibende Zeit:" timeout_seconds = 722 def is_displayed(self): return self.player.condition == "14.02." and self.player.Singleplayer == 1 and self.participant.vars["timeout"] == 0 class InfoAboutChat(Page): form_model = "player" timeout_seconds = 120 def is_displayed(self): return self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 class WaitPostSimpson(WaitPage): title_text = "Bitte ein wenig Geduld!" body_text = "Sie waren schneller als Ihre Gruppenmitglieder. Wir bitten Sie, die verbleibende Zeit zu warten, es wird nicht lange dauern." template_name = "global/WaitPage.html" # global WaitPage-template def is_displayed(self): return self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 class Chat11(Page): form_model = "player" timer_text = "Verbleibende Zeit:" timeout_seconds = 365 def is_displayed(self): return self.player.condition == "11.02." and self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 class Chat12(Page): form_model = "player" timer_text = "Verbleibende Zeit:" timeout_seconds = 365 def is_displayed(self): return self.player.condition == "12.02." and self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 class Chat13(Page): form_model = "player" timer_text = "Verbleibende Zeit:" timeout_seconds = 365 def is_displayed(self): return self.player.condition == "13.02." and self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 class Chat14(Page): form_model = "player" timer_text = "Verbleibende Zeit:" timeout_seconds = 365 def is_displayed(self): return self.player.condition == "14.02." and self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 ### Entscheidungsseiten ### class GroupDecision1(Page): form_model = "player" form_fields = ["decGroup1", "confGroup1"] #timeout timeout_seconds = 120 def is_displayed(self): return self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 class CheckDisagreement1(WaitPage): # Am Design noch was machen? title_text = "Einen Moment bitte" body_text = "Die anderen Gruppenmitglieder geben die Gruppenentscheidung ab." after_all_players_arrive = "check_for_disagreement_one" template_name = "global/WaitPage.html" # global WaitPage-template def is_displayed(self): return self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 class GroupDecision2(Page): # disagreement checks def is_displayed(self): return self.player.disagreement == 1 and self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 #timeout timeout_seconds = 120 form_model = "player" form_fields = ["decGroup2", "confGroup2"] class CheckDisagreement2(WaitPage): # Am Design noch was machen? title_text = "Einen Moment bitte" body_text = "Die anderen Gruppenmitglieder geben die Gruppenentscheidung ab." after_all_players_arrive = "check_for_disagreement_two" template_name = "global/WaitPage.html" # global WaitPage-template def is_displayed(self): return self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 class GroupDecision3(Page): # disagreement checks def is_displayed(self): return self.player.disagreement == 2 and self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 #timeout timeout_seconds = 120 form_model = "player" form_fields = ["decGroup3", "confGroup3"] class PageBetweenGroupAndSingleDec(Page): form_model = "player" def is_displayed(self): return self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 #timeout timeout_seconds = 1200 ### Individueller Teil und Ende ### class IndividualDecisionPreChat(Page): form_model = "player" form_fields = ["decGroupIndPreChat", "confGroupIndPreChat"] def is_displayed(self): return self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 #timeout timeout_seconds = 120 class IndividualDecisionPostChat(Page): form_model = "player" form_fields = ["decGroupIndPostChat", "confGroupIndPostChat"] def is_displayed(self): return self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 #timeout timeout_seconds = 1200 class IndividualDecisionSingleplayer(Page): form_model = "player" form_fields = ["decSingle", "confSingle"] def is_displayed(self): return self.player.Singleplayer == 1 and self.participant.vars["timeout"] == 0 #timeout timeout_seconds = 1200 def before_next_page(self): if self.timeout_happened: self.participant.vars["timeout"] = 1 else: pass class Strategy(Page): form_model = "player" form_fields = ["strategySingle"] def is_displayed(self): return self.player.Singleplayer == 1 and self.participant.vars["timeout"] == 0 #timeout timeout_seconds = 1200 def before_next_page(self): if self.timeout_happened: self.participant.vars["timeout"] = 1 else: pass #def before_next_page(self): #import time #self.player.timeEnded = time.time() class ManipulationChecks1(Page): form_model = "player" form_fields = ["austauschChat", "relationship", "vigilanzSelbst", "vigilanzVP1", "vigilanzVP2", "vigilanzVP3", "kompetenzVP1", "kompetenzVP2", "kompetenzVP3", "ehrlichkeitVP1", "ehrlichkeitVP2", "ehrlichkeitVP3", "serioesitaetVP1", "serioesitaetVP2", "serioesitaetVP3", "kompetenzArtikel1", "kompetenzArtikel2", "ehrlichkeitArtikel1", "ehrlichkeitArtikel2", "serioesitaetArtikel1", "serioesitaetArtikel2"] def is_displayed(self): return self.player.Singleplayer == 0 and self.participant.vars["timeout"] == 0 #timeout timeout_seconds = 1200 def before_next_page(self): if self.timeout_happened: self.participant.vars["timeout"] = 1 else: pass class ManipulationChecks2(Page): form_model = "player" form_fields = ["studieBekannt", "chatZeit", "chatNutzung", "tastaturNutzung", "Polizeigewalt", "Rassismus"] def is_displayed(self): return self.participant.vars["timeout"] == 0 #timeout timeout_seconds = 1200 def before_next_page(self): if self.timeout_happened: self.participant.vars["timeout"] = 1 else: pass #def before_next_page(self): #import time #self.player.timeEnded = time.time() ### Page sequence ### page_sequence = [WaitAndGrouping, InstructionsGroup, InstructionsSingleplayer, WaitPreSimpson, SimpsonCond11, SimpsonCond12, SimpsonCond13, SimpsonCond14, IndividualDecisionPreChat, SimpsonCondSingleplayer11, SimpsonCondSingleplayer12, SimpsonCondSingleplayer13, SimpsonCondSingleplayer14, InfoAboutChat, WaitPostSimpson, Chat11, Chat12, Chat13, Chat14, GroupDecision1, CheckDisagreement1, GroupDecision2, CheckDisagreement2, GroupDecision3, PageBetweenGroupAndSingleDec, IndividualDecisionPostChat, IndividualDecisionSingleplayer, Strategy, ManipulationChecks1, ManipulationChecks2]