from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) from radiogrid import RadioGridField from django.core import validators from django.forms import CharField import random from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) from django import forms author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'media_feedback' players_per_group = 3 num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass ROWS = ( (1, "Image 1"), (2, "Image 2"), (3, "Image 3"), (4, "Image 4"), (5, "Image 5"), (6, "Image 6"), (7, "Image 7"), (8, "Image 8"), (9, "Image 9"), (10, "Image 10"), (11, "Image 11"), (12, "Image 12"), (13, "Image 13"), (14, "Image 14"), (15, "Image 15") ) COLUMNS = ( (1, "Neutral"), (2, "Discriminatory"), (3, "Counter-discriminatory"), ) class Player(BasePlayer): media_earnings = models.CurrencyField(default=0) def set_payoffs(self): if self.s1q1 == 2 and self.s1q2 == 2: self.media_earnings = 32 else: self.media_earnings = 0 if self.s2q1 == 2 and self.s2q2 == 1: self.media_earnings += 32 else: self.media_earnings += 0 if self.s3q1 == 1 and self.s3q2 == 1: self.media_earnings += 32 else: self.media_earnings += 0 if self.s4q1 == 1 and self.s4q2 == 2: self.media_earnings += 32 else: self.media_earnings += 0 if self.s5q1 == 1 and self.s5q2 == 3: self.media_earnings += 32 else: self.media_earnings += 0 s1q1 = models.IntegerField( label="Do all the parties agree that the youth worker card should be reinstated without changing " "the initiative?", choices=[ [1, 'Yes.'], [2, 'No.'], ], widget=widgets.RadioSelect, ) s1q2 = models.IntegerField( label="What benefit does the youth worker card give?", choices=[ [1, 'It allows workers under the age of 30 to travel to job interviews for free.'], [2, 'It allows workers under the age of 30 to travel for free if their place of ' 'work is far from their home.'], ], widget=widgets.RadioSelect, ) s2q1 = models.IntegerField( label="Is the subject of the article appointed to the Culture committee according to the article?", choices=[ [1, 'Yes.'], [2, 'No.'], ], widget=widgets.RadioSelect, ) s2q2 = models.IntegerField( label="What was the problem with the government’s approach to unemployment according to the subject of " "the article?", choices=[ [1, 'That it was revoking government spending on training schemes.'], [2, 'That it was investing money in rural employment trainings.'], ], widget=widgets.RadioSelect, ) s3q1 = models.IntegerField( label="True or false: both those over 50 and those between 25 and 34 years old have experienced " "a jump in employment?", choices=[ [1, 'True.'], [2, 'False.'], ], widget=widgets.RadioSelect, ) s3q2 = models.IntegerField( label="What is an accurate summary of the article?", choices=[ [1, 'Although unemployment, including youth unemployment, is at a low level right now, there are still ' 'concerns due to the long period of economic downturn.'], [2, 'Other countries are faring much better in terms of unemployment, even if things are going well here.'], [3, 'The National Statistics Organisation has not collected figures on the level of unemployment yet.'], ], widget=widgets.RadioSelect, ) s4q1 = models.IntegerField( label="According to the study, is youth unemployment a national health issue?", choices=[ [1, 'Yes.'], [2, 'No.'], ], widget=widgets.RadioSelect, ) s4q2 = models.IntegerField( label="What does the article mention can make the societal impact of youth unemployment even worse?", choices=[ [1, 'Natural disasters.'], [2, 'Recession.'], [3, 'Trade deficits.'], ], widget=widgets.RadioSelect, ) s5q1 = models.IntegerField( label="True or false: A study suggests that government focus should shift to consider personal " "or social well-being as well as economic factors behind happiness.", choices=[ [1, 'True.'], [2, 'False.'], ], widget=widgets.RadioSelect, ) s5q2 = models.IntegerField( label="Having a partner increased happiness of respondents in the survey by 0.6 points. How much did " "doubling a person’s income increase their happiness?", choices=[ [1, '0.8 points.'], [2, '0.5 points.'], [3, '0.2 points.'], ], widget=widgets.RadioSelect, ) treatment1 = models.IntegerField( label="What treatment did you think sample 1 was?", choices=[ [1, 'Neutral'], [2, 'Discriminatory'], [3, 'Counter-discriminatory'], ], widget=widgets.RadioSelect, ) treatment2 = models.IntegerField( label="What treatment did you think sample 2 was?", choices=[ [1, 'Neutral'], [2, 'Discriminatory'], [3, 'Counter-discriminatory'], ], widget=widgets.RadioSelect, ) treatment3 = models.IntegerField( label="What treatment did you think sample 3 was?", choices=[ [1, 'Neutral'], [2, 'Discriminatory'], [3, 'Counter-discriminatory'], ], widget=widgets.RadioSelect, ) treatment4 = models.IntegerField( label="What treatment did you think sample 4 was?", choices=[ [1, 'Neutral'], [2, 'Discriminatory'], [3, 'Counter-discriminatory'], ], widget=widgets.RadioSelect, ) treatment5 = models.IntegerField( label="What treatment did you think sample 5 was?", choices=[ [1, 'Neutral'], [2, 'Discriminatory'], [3, 'Counter-discriminatory'], ], widget=widgets.RadioSelect, ) pictures = RadioGridField(rows=ROWS, values=COLUMNS, require_all_fields=True, null=True, verbose_name="What treatment do you think each picture belongs to? Use your " "initial impression, rather than spending more than a few seconds " "on each picture.") final_comment = models.StringField( label='You can leave a free comment here:', null=True, blank=True, )