from ._builtin import Page, WaitPage from .models import Constants import json import random ######################## ## INTRO ## ######################## class Introduction(Page): form_model = 'player' form_fields = ['consent'] ######################## ## READING ARTICLE ## ######################## # ACTUAL ARTICLE TO READ class Article(Page): def vars_for_template(self): if self.player.econ_topic == 1: return dict( LABEL='US Stock Market Index', ) else: return dict( LABEL='the number of Covid19 cases in the US', ) # CONTROLS QUESTIONS class ControlQuestions(Page): form_model = 'player' form_fields = ['control_1', 'control_2', 'control_3'] def vars_for_template(self): if self.player.econ_topic == 1: return dict( L1='The article states that the Cboe Volatility Index, or the VIX, recently denoted 25.', L2='The article states that investors are concerned that inflation will lead to lower consumer spending, which makes up 90% of the U.S. economy.', L3='The article states that experts expect inflation to stay above 7% for the next few years.' ) else: return dict( L1='The article states that the virus is still infecting around 150,000 people each day.', L2='The article states that at the peak of the Omicron wave, there were more than 2,600 deaths per day in the U.S.', L3='The article states that the new subvariant BA.2.75 recently started spreading rapidly in China.' ) def before_next_page(self): self.player.payoffs_() # RATING OF ARTICLES class ArticleRating(Page): form_model = 'player' form_fields = ['skew', 'reliance', 'inspiring', 'objectivity1', 'objectivity2', 'objectivity3', 'trust1', 'trust2', 'recommendation1', 'recommendation2', 'recommendation3', 'recommendation4', 'recommendation5'] def vars_for_template(self): if self.player.econ_topic == 1: return dict( L1='If someone is interested in the development of the U.S. Total Stock Market Index (Dow Jones) over the next month, how likely is it that you would recommend that article to them?', L2='This article is very helpful to better anticipate the development of the U.S. Total Stock Market Index (Dow Jones) over the next month.', L3='Someone who reads this article will be more likely to make an accurate forecast of the development of the U.S. Total Stock Market Index (Dow Jones) over the next month, than someone who does not read it.', L4='The article concentrates on important occurrences, highly relevant to the development of the U.S. Total Stock Market Index (Dow Jones), rather than featuring miscellaneous.', L5='The article presents substantial background information highly relevant to the development of the U.S. Total Stock Market Index (Dow Jones).', ) else: return dict( L1='If someone is interested in the development of the number of Covid 19 cases in the U.S. over the next month, how likely is it that you would recommend that article to them?', L2='This article is very helpful to better anticipate the development of the number of Covid 19 cases in the U.S. over the next month.', L3='Someone who reads this article will be more likely to make an accurate forecast of the development of the number of Covid 19 cases in the U.S. over the next month, than someone who does not read it.', L4='The article concentrates on important occurrences, highly relevant to the development of the number of Covid 19 cases in the U.S., rather than featuring miscellaneous.', L5='The article presents substantial background information highly relevant to the development of the number of Covid 19 cases in the U.S..', ) ######################## ## QUESTIONNAIRE ## ######################## class Questionnaire1(Page): form_model = 'player' form_fields = ['age', 'female', 'degree', 'ethnicity', 'area' , 'risk_aversion', 'altruism', 'republican_1'] random.shuffle(form_fields) class Questionnaire2(Page): form_model = 'player' def get_form_fields(self): if (self.player.republican_1 == 1) | (self.player.republican_1 == 2): return ['republican_2'] else: return ['republican_3'] class Questionnaire(Page): form_model = 'player' temp1 = ['algo_aver1', 'algo_aver2', 'algo_aver3' , 'algo_aver4', 'techn_open1', 'techn_open2', 'techn_open3', 'techn_open4' ,'techn_open5', 'soc_norm1', 'soc_norm2', 'soc_norm3', 'soc_norm4'] random.shuffle(temp1) form_fields = temp1 + ['prediction', 'conf'] def vars_for_template(self): if self.player.econ_topic == 1: return dict( L1='Please indicate your personal expectation: Over the next month the U.S. Total Stock Market Index (Dow Jones) will...', ) else: return dict( L1='Please indicate your personal expectation: Over the next month the number of Covid cases in the U.S. will...', ) ######################## ## RESULTS ## ######################## class Results(Page): form_model = 'player' form_fields = ['open_comment'] def vars_for_template(self): return dict(corr_answers=self.participant.vars['correct_answers'], corr_income=self.participant.vars['income_answers'], url='https://app.prolific.co/submissions/complete?cc=C14ZXU2N') ########################################## ##### APP SEQUENCE ##### ########################################## page_sequence = [Introduction, Article, ArticleRating, ControlQuestions, Questionnaire1, Questionnaire2, Questionnaire, Results]