from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants import os BASE_DIR = os.path.dirname(os.path.abspath(__file__)) class welcome(Page): form_model ='player' form_fields= ['adult', 'willing', "smartphone", 'useto'] class informed(Page): form_model = 'player' form_fields = ['expl','vol','haveread','withdraw','informed'] class howtouseapp(Page): form_model ='player' class yourtask1(Page): form_model = 'player' form_fields = ['seemorebutton','truthearning','truthquality','scorecommon'] def is_displayed(self): return self.participant.vars['treatment'] == "gone" def error_message(self, values): if values['truthearning'] != 'increases': return 'Answer for the first question not correct' if values['truthquality'] != 'increases': return 'Answer for the second question not correct' if values['scorecommon'] != 'group': return 'Answer for the third question not correct' class yourtask2(Page): form_model = 'player' form_fields = ['allattr','secondquestiongtwo'] def is_displayed(self): return self.participant.vars['treatment'] == "gtwo" def error_message(self, values): if values['allattr'] != "increases": return ' Answer to the first question not correct' if values['secondquestiongtwo'] != 'noimpact': return 'Answer for the second question not correct' class yourtask3(Page): form_model ="player" form_fields =['allattrgthree','secondquestiongthree'] def is_displayed(self): return self.participant.vars['treatment'] == "gthree" def error_message(self, values): if values['allattrgthree'] != "increases": return ' Answer to the first question not correct' if values['secondquestiongthree'] != 'noimpact': return 'Answer for the second question not correct' class task2(Page): form_model = 'player' class report(Page): form_model = 'player' form_fields = ['time','distance','averagepace','fastestpace','ascent','descent','energy','kmormile1','kmormile2','kmormile3','kmormile4','kmormile5','calorjoules'] def error_message(self, values): if ':' not in values['time']: return 'Please your time i the required format.' def is_displayed(self): return self.participant.vars['treatment'] != "gthree" class report3(Page): form_model = 'player' form_fields = ['image','time','distance','averagepace','fastestpace','ascent','descent','energy','kmormile1','kmormile2','kmormile3','kmormile4','kmormile5','calorjoules'] def error_message(self, values): if ':' not in values['time']: return 'Please your time i the required format.' def is_displayed(self): return self.participant.vars['treatment'] == "gthree" class demographics(Page): form_model = 'player' form_fields = ['gender','age','corona','phonebrand','exactphone','otherphone','paidversion','steplengthinfo','tragbaresfitnessgerät','risktaker','weight','weightunit','height','heightunit'] class earnings(Page): form_model = 'player' form_fields =['fairbewerten','wahrheitsgetreu1','wahrheitsgetreu2','ermöglicht','Datenerfassung','personalisierte','Zusammenhang'] def is_displayed(self): return self.participant.vars['treatment'] == "gone" class earnings2(Page): form_model = 'player' form_fields =['wahrheitsgetreu1','wahrheitsgetreu2','ermöglicht','Datenerfassung','personalisierte','Zusammenhang'] def is_displayed(self): return self.participant.vars['treatment'] != "gone" ##### class end(Page): form_model ='player' class badend(Page): form_model= 'player' def is_displayed(self): if not self.player.adult or not self.player.willing or not self.player.smartphone or not self.player.useto : return True else: return False page_sequence = [welcome, badend, informed, howtouseapp,yourtask1,yourtask2,yourtask3, report, report3 ,demographics,earnings,earnings2,end]