from otree.api import * from random import shuffle c = Currency doc = """ Post experimental questions. """ class Constants(BaseConstants): name_in_url = 'csr_peq' players_per_group = None num_rounds = 1 peq_fields_1 = ["q1a", "q1b", "q1c", "q1d", "q1e", "q1f"] peq_fields_2 = ["q2a", "q2b", "q2c", "q2d", "q2e"] peq_fields_dm = ["dmq1", "dmq2", "dmq3", "dmq4", "dmq5", "dmq6", "dmq7"] peq_fields_coo = ["cooq1", "cooq2", "cooq3"] peq_fields_likert = [f"likert_{n}" for n in range(1, 6)] peq_fields = peq_fields_1 + peq_fields_2 + peq_fields_dm + peq_fields_coo + peq_fields_likert peq_labels = [ "(a) - How strongly do you personally believe that companies like Summit Corporation should" " engage in socially-responsible activities in general?", "(b) - How strongly do you personally believe that companies like Summit Corporation should engage in " "green initiatives?", "(c) - How strongly do you personally believe that companies like Summit Corporation should " "sacrifice profitability to promote social causes?", "(d) - In the decision-making situation in this study, to what extent were you concerned that the " "tree-planting project may negatively affect the company’s financial performance?", "(e) - In the decision-making situation in this study, to what extent were you concerned " "about making money for yourself?", "(f) - In the decision-making situation in this study, to what extent did you consider the benefits " "that tree planting can bring to society?", "(a) - My tree-planting decision makes a contribution to the society.", "(b) - My tree-planting decision is helpful for the company’s sustainable development.", "(c) - My tree-planting decision is valuable for fulfilling social responsibility.", "(d) - Often I engage in particular behaviour in order to achieve outcomes that may not result " "for many years.", "(e) - I believe climate change is real.", "(f) - I feel trusted by the company.", "(g) - I think the way the company determines the tree-planting investment was fair.", "(h) - I am willing to work with the company in the future.", "(i) - I think the amount invested in tree planting was reasonable.", "(j) - I feel pushed around in the tree-planting decision process.", "(k) - I think the COO is a good leader.", "(l) - The fact that the COO received a bonus based on the amount invested in the tree-planting project " "impacted the amount I was willing to return to the COO.", "(f) - I think the way the company determines the tree-planting investment was fair.", "(g) - I think the amount invested in tree planting was reasonable.", "(h) - The fact that I received a bonus based on the amount invested in the tree-planting project " "impacted the amount I would want the DM to invest in the tree-planting project.", "...socially responsible", "...ethical", "...financially responsible", "...honest", "...environmentally responsible", ] choices = list(range(1, 12)) likert_labels = [ 'Very Strongly Disagree', 'Strongly Disagree', 'Disagree', 'Somewhat Disagree', 'Neither Agree nor Disagree', 'Somewhat Agree', 'Agree', 'Strongly agree', 'Very Strongly Agree', 'No Response' ] choices_likert = list(range(1, 11)) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): for n, f in enumerate(Constants.peq_fields): locals()[f] = models.IntegerField( label=Constants.peq_labels[n], choices=Constants.choices if not 'likert' in f else Constants.choices_likert, widget=widgets.RadioSelectHorizontal, blank=True ) del n, f # PAGES class PEQ1(Page): form_model = "player" form_fields = Constants.peq_fields_1 class PEQ2(Page): form_model = "player" form_fields = Constants.peq_fields_2 class PEQ3(Page): form_model = "player" @staticmethod def get_form_fields(player: Player): if player.participant.role == 'DM': return Constants.peq_fields_dm else: return Constants.peq_fields_coo class PEQ4(Page): form_model = "player" @staticmethod def get_form_fields(player: Player): fields = Constants.peq_fields_likert.copy() shuffle(fields) return fields page_sequence = [PEQ1, PEQ2, PEQ3, PEQ4]