class Player(BasePlayer): # Para el pay-off del sistema def set_payoffs(self): p.payoff = self.player.quiz_earnings def current_field(self): return 'question_{}_response'.format(self.quiz_page_counter + 1) quiz_incorrect_answer = models.StringField(initial=None) quiz_respuesta_incorrecta = models.StringField(initial=None) # IP field player_ip = models.StringField() current_practice_page = models.IntegerField(initial=0) '''Quiz''' # Contar las preguntas correctas acertadas a la primera num_correct = models.IntegerField(initial=0) quiz_page_counter = models.IntegerField(initial=0) # Inc Attemp per question q_incorrect_attempts = models.IntegerField(initial=0) q_timeout = models.IntegerField(initial=0) q_validation = models.IntegerField(initial=0) q_attempts = models.IntegerField(initial=0) error_sequence = models.CharField(initial='') timeout_sequence = models.CharField(initial='') question_1_response = models.IntegerField(verbose_name='', widget=widgets.RadioSelect, choices=Constants.q1_choices) question_2_response = models.IntegerField(verbose_name='', widget=widgets.RadioSelect, choices=Constants.q2_choices) question_3_response = models.IntegerField(verbose_name='', widget=widgets.RadioSelect, choices=Constants.q3_choices) question_4_response = models.IntegerField(verbose_name='', widget=widgets.RadioSelect, choices=Constants.q4_choices) quiz_earnings = models.CurrencyField(initial=0) # Hidden Field for detecting bots quiz_dec_2 = models.LongStringField(blank=True)
class Player(BasePlayer): def set_payoff(self): """Calculate payoff, which is zero for the survey""" self.payoff = 0 q_country = models.CharField(verbose_name='あなたの出身国を教えて下さい.', initial=None) q_age = models.PositiveIntegerField(verbose_name='あなたの年齢を教えてください.', choices=range(13, 125), initial=None) q_gender = models.CharField(initial=None, choices=['男性', '女性'], verbose_name='あなたの性別を教えてください.', widget=widgets.RadioSelect()) crt_bat = models.PositiveIntegerField() crt_widget = models.PositiveIntegerField() crt_lake = models.PositiveIntegerField()
class Player(BasePlayer): ammount_given = models.CurrencyField( doc="""Amount dictator decided to give to the other player""", min=0, max=Constants.allocated_amount, widget=widgets.SliderInput(), verbose_name='I will give (from 0 to %i)' % Constants.allocated_amount) trust_type = models.CharField(max_length=20, choices=Constants.ttypes)
class Player(BasePlayer): #Instruction Questions basics_q1 = models.CharField(doc = "Instructions quiz, basics") # basics_q2 = models.CharField(doc = "Instructions quiz, basics 2") product_selected = models.IntegerField(doc="ID of product selected by participant") product_best = models.IntegerField(doc = "ID of project that is utility maximizing for participant") is_mistake = models.IntegerField(doc = "1 if product selected by participant was suboptimal") product_selected_dims = models.IntegerField(doc="dimvals of product selected by participant")
class Player(BasePlayer): time_eyes_instructions = models.TextField(widget=widgets.HiddenInput( attrs={'id': 'arrive_time'})) time_Question = models.TextField(widget=widgets.HiddenInput( attrs={'id': 'arrive_time'})) question_id = models.PositiveIntegerField() question = models.CharField() solution = models.CharField() submitted_answer = models.CharField(widget=widgets.RadioSelect()) is_correct = models.BooleanField() def current_question(self): return self.session.vars['questions'][self.round_number - 1] def check_correct(self): self.is_correct = self.submitted_answer == self.solution
class ExogenousEventFile(Model): upload_time = models.DateTimeField(auto_now_add=True) upload_name = models.StringField() code = models.CharField(primary_key=True, default=random_chars_8, editable=False, null=False) record_type = models.StringField()
class Player(BasePlayer): age = models.PositiveIntegerField(verbose_name='What is your age?', min=13, max=125) gender = models.CharField(choices=['Male', 'Female'], verbose_name='What is your gender?', widget=widgets.RadioSelect()) comment = models.CharField( verbose_name='Please tells us your Comments and Thoughts on the Study!', help_text='Please type at least 50 characters.', widget=widgets.Textarea(), validators=[MinLengthValidator(50)], error_messages={ 'min_length': 'You have typed %(show_value)d characters.' })
class AdminChatMessage(models.Model): class Meta: index_together = ['channel', 'timestamp'] # the name "channel" here is unrelated to Django channels channel = models.CharField(max_length=255) # related_name necessary to disambiguate with otreechat add on participant = models.ForeignKey('otree.Participant', related_name='admin_chat_messages', on_delete=models.CASCADE) nickname = models.CharField(max_length=255) # call it 'body' instead of 'message' or 'content' because those terms # are already used by channels body = models.TextField() timestamp = models.FloatField(default=time.time) is_seen = models.BooleanField(default=False)
class PrivateMessage(models.Model): wall = models.ForeignKey(PrivateMessageBoard) createdBy = models.ForeignKey(Node) datetime = models.DateTimeField(auto_now=True) message = models.CharField() messageRound = models.IntegerField() deleted = models.BooleanField(initial=False) key = models.CharField() def to_dict(self): return { 'id': self.id, 'timestamp': self.datetime.strftime("%Y-%m-%d %H:%M:%S"), 'content': self.message, 'author': 'Player {}'.format(self.createdBy_id), 'messageRound': self.messageRound, 'key': self.key, }
class Player(BasePlayer): q1 = models.CharField(doc="Question 1") q2 = models.IntegerField(doc="Question 2") treatment = models.CharField(doc="Treatment") injunctive_norm_type = models.CharField(initial='undefined_IT') def role(self): if ((self.participant.vars['treatment'] == 'DTI')) and (self.q2 == 1): self.participant.vars['injunctive_norm_type'] = 'eco' elif ((self.participant.vars['treatment'] == 'DTI')) and (self.q2 == 2): self.participant.vars['injunctive_norm_type'] = 'type1' elif ((self.participant.vars['treatment'] == 'DTI')) and (self.q2 == 3): self.participant.vars['injunctive_norm_type'] = 'type2' else: self.participant.vars['injunctive_norm_type'] = 'undefined_IT' return self.participant.vars['injunctive_norm_type']
class Player(BasePlayer): advice_1 = models.StringField() verbal_1 = models.StringField() advice_2 = models.StringField() verbal_2 = models.StringField() q1 = models.StringField(widget=forms.CheckboxSelectMultiple( choices=(("1", ""), ("2", ""), ("3", "")))) b = models.BooleanField(initial=False) type_number = models.CharField(max_length=1)
class Player(BasePlayer): f_bool = models.BooleanField() f_posint = models.IntegerField(min=2) f_float = models.FloatField() f_currency = models.CurrencyField() f_char = models.CharField() foo = models.PositiveIntegerField() timeout_happened = models.BooleanField(initial=False)
class Player(BasePlayer): starttime = models.FloatField() endtime = models.FloatField() decision = models.PositiveIntegerField(choices=[0, 1, 2, 3, 4, 5, 6], widget=widgets.RadioSelect()) state = models.PositiveIntegerField() truestate = models.CharField() truedecision = models.CharField() check1 = models.PositiveIntegerField( choices=[[1, '936'], [2, '364'], [3, '858']], widget=widgets.RadioSelect(), blank=True) check2 = models.PositiveIntegerField( choices=[[1, '0'], [2, '1/7'], [3, '5/7']], widget=widgets.RadioSelect(), blank=True) check3 = models.PositiveIntegerField( choices=[[1, '5/7'], [2, '1/7'], [3, '2/7']], widget=widgets.RadioSelect(), blank=True) check4 = models.PositiveIntegerField( choices=[[1, '1/7'], [2, '0'], [3, '5/7']], widget=widgets.RadioSelect(), blank=True) check5 = models.PositiveIntegerField( choices=[[1, '£0.11'], [2, '£11.30'], [3, '£1.13']], widget=widgets.RadioSelect(), blank=True)
class Player(BasePlayer): name = models.StringField() pronoun = models.StringField() pronoun_possessive = models.StringField() pronoun_object = models.StringField() ability = models.IntegerField() ability_comp = models.IntegerField() ability_score = models.IntegerField() captcha = models.CharField(blank=True) understanding1a = models.StringField() understanding1b = models.StringField() understanding1c = models.StringField() understanding2 = models.StringField(choices=qtext['understanding2'], widget=widgets.RadioSelect) understanding3 = models.StringField() match_guess_terrible = models.StringField( choices=qtext['social_appropriate_ratings'], widget=widgets.RadioSelect) match_guess_very_poor = models.StringField( choices=qtext['social_appropriate_ratings'], widget=widgets.RadioSelect) # match_guess_poor = models.StringField(choices=qtext['social_appropriate_ratings'], widget=widgets.RadioSelect) match_guess_neutral = models.StringField( choices=qtext['social_appropriate_ratings'], widget=widgets.RadioSelect) match_guess_good = models.StringField( choices=qtext['social_appropriate_ratings'], widget=widgets.RadioSelect) match_guess_very_good = models.StringField( choices=qtext['social_appropriate_ratings'], widget=widgets.RadioSelect) match_guess_exceptional = models.StringField( choices=qtext['social_appropriate_ratings'], widget=widgets.RadioSelect) personal_terrible = models.StringField( choices=qtext['appropriate_ratings'], widget=widgets.RadioSelect) personal_very_poor = models.StringField( choices=qtext['appropriate_ratings'], widget=widgets.RadioSelect) # personal_poor = models.StringField(choices=qtext['appropriate_ratings'], widget=widgets.RadioSelect) personal_neutral = models.StringField(choices=qtext['appropriate_ratings'], widget=widgets.RadioSelect) personal_good = models.StringField(choices=qtext['appropriate_ratings'], widget=widgets.RadioSelect) personal_very_good = models.StringField( choices=qtext['appropriate_ratings'], widget=widgets.RadioSelect) personal_exceptional = models.StringField( choices=qtext['appropriate_ratings'], widget=widgets.RadioSelect) # error messages for understanding 1x are on the page class def understanding2_error_message(self, value): if value != qtext['understanding2'][0]: return 'Sorry. Your answer is incorrect. Please choose the correct answer to proceed.' def understanding3_error_message(self, value): if value.lower() != 'true': return 'Sorry. Your answer is incorrect. Please choose the correct answer to proceed.'
class Player(BasePlayer): stratum = models.PositiveIntegerField() sex = models.CharField(choices=Constants.sex_selection, verbose_name='What is your sex?') age = models.PositiveIntegerField(max=100, verbose_name='What is your age?') education = models.CharField( choices=Constants.education_selection, verbose_name='What is your highest level of education?') occupation = models.CharField( choices=Constants.occupation_selection, verbose_name='What is your current type of occupation?') income = models.CharField( choices=Constants.income_selection, verbose_name='What is your annual income in Euro?') previous_donation = models.CharField( choices=Constants.previous_donation_selection, verbose_name='How many Euros have you donated last year?')
class Player(BasePlayer): q1 = models.CharField(doc="Question 1") q2 = models.IntegerField(doc="Question 2") def role(self): if (self.q1 == "e") and self.q2 == 1: self.participant.vars[ 'injunctive_norm '] = 'ecologic_inj_role_participant' return self.participant.vars['injunctive_norm ']
class Player(BasePlayer): presented_word = models.CharField() correct_match = models.CharField() def get_pair(self): word = Constants.words[self.round_number] self.presented_word = word self.correct_match = Constants.pairs[word] hometime_choice = models.CharField( choices=[["rest", "Just rest for the hometime period"], ["game", "Play a game for the hometime period"], ["study", "Study the word pairs for the hometime period"]]) pair_choice = models.CharField(choices=list(Constants.pairs.values())) player_choice_final = models.CharField( choices=list(Constants.pairs.values())) hovercount = models.IntegerField(default=0) hovertime = models.IntegerField(default=0) hover_json = models.StringField(blank=True) # i don't like hardcoding it like this # but unless you want to interpret a json string # in the analysis, this is the cleanest way hovercount1 = models.IntegerField(default=0) hovertime1 = models.IntegerField(default=0) hovercount2 = models.IntegerField(default=0) hovertime2 = models.IntegerField(default=0) hovercount3 = models.IntegerField(default=0) hovertime3 = models.IntegerField(default=0) hovercount4 = models.IntegerField(default=0) hovertime4 = models.IntegerField(default=0) hover_json1 = models.StringField(blank=True) hover_json2 = models.StringField(blank=True) hover_json3 = models.StringField(blank=True) hover_json4 = models.StringField(blank=True) def evaluate_choice(self): return (self.pair_choice == Group.correct_match)
class Player(BasePlayer): investment = models.CurrencyField(verbose_name="How much to invest?") lottery_outcome = models.CharField(choices=['heads', 'tails']) def flip_and_calculate(self): self.lottery_outcome = random.choice(['heads', 'tails']) if self.lottery_outcome == "heads": self.payoff = Constants.endowment + self.investment else: self.payoff = Constants.endowment - self.investment
class Player(BasePlayer): role = models.CharField() def role_assignment(self): if self.id_in_group == 1: self.role = 'Chat Kroeger' elif self.id_in_group == 2: self.role = 'Text Bundy' else: self.role = 'Write or Wrong'
class Player(BasePlayer): name = models.CharField() accept = models.BooleanField( doc="""Whether subject accepts the consent form""", widget=widgets.RadioSelect, choices=[ [True, 'Accept'], [False, 'Reject'], ])
class Player(BasePlayer): donation = models.CurrencyField( min=0, max=Constants.endowment, doc="donation in EUR", verbose_name='How much do you want to donate?') treatment = models.CharField(choices=Constants.treatment_specifications) claimed_content = models.CharField( choices=Constants.treatment_specifications + Constants.additional_specifications, doc="Claimed content of the picture", verbose_name="What do you see in the picture on the previous page?") claimed_content_correct = models.BooleanField() def check_claim(self): self.claimed_content_correct = self.treatment == self.claimed_content def calculate_payoff(self): self.payoff = Constants.endowment - self.donation
class Player(BasePlayer): treat = models.CharField(doc="Treatment of each player") consumption = models.CurrencyField(min=0, doc="endowment by each player") rconsumption = models.FloatField() savings = models.CurrencyField(min=0, max=Constants.max_savings, doc="Savings by each player", choices=[c(0), c(2), c(4)]) financial_reward = models.FloatField(min=0) last_savings = models.CurrencyField()
class Player(BasePlayer): sumOfMax = models.PositiveIntegerField( verbose_name = "Please sum the maximum numbers from Left and Right tables and insert in the box ", min=20, max=198 ) age = models.PositiveIntegerField( verbose_name='What is your age?', min=13, max=125) gender = models.CharField( choices= ['Male', 'Female'], verbose_name='What is your gender?', widget = widgets.RadioSelect) names = models.CharField( choices= [], verbose_name='Please select a name', widget = widgets.RadioSelect) crt_bat = models.PositiveIntegerField( verbose_name=''' A bat and a ball cost 22 dollars in total. The bat costs 20 dollars more than the ball. How many dollars does the ball cost?''' ) crt_widget = models.PositiveIntegerField( verbose_name=''' "If it takes 5 machines 5 minutes to make 5 widgets, how many minutes would it take 100 machines to make 100 widgets?" ''' ) crt_lake = models.PositiveIntegerField( verbose_name=''' In a lake, there is a patch of lily pads. Every day, the patch doubles in size. If it takes 48 days for the patch to cover the entire lake, how many days would it take for the patch to cover half of the lake? ''' )
class Player(BasePlayer): qa1 = models.BooleanField(choices = [(True, 'True'), (False, 'False')]) qa2 = models.BooleanField(choices = [(True, 'True'), (False, 'False')]) qa3 = models.BooleanField(choices = [(True, 'True'), (False, 'False')]) qb1a = models.CharField(choices = ['100 points', '50 points', '0 points']) qb1b = models.CharField(choices = ['100 points', '50 points', '0 points']) qb1c = models.CharField(choices = ['100 points', '50 points', '0 points']) qb2a = models.CharField(choices = ['100 points', '50 points', '0 points']) # qb2b = models.CharField(choices = ['100 points', '50 points', '0 points']) qb2c = models.CharField(choices = ['100 points', '50 points', '0 points']) qb2d = models.CharField(choices = ['100 points', '50 points', '0 points']) qb3a = models.CharField(choices = ['100 points', '50 points', '0 points']) # qb3b = models.CharField(choices = ['100 points', '50 points', '0 points']) qb3c = models.CharField(choices = ['100 points', '50 points', '0 points']) # qb3d = models.CharField(choices = ['100 points', '50 points', '0 points']) qb3e = models.CharField(choices = ['100 points', '50 points', '0 points']) qb3f = models.CharField(choices = ['100 points', '50 points', '0 points'])
class Player(BasePlayer): treatment = models.CharField() wage_offer = models.IntegerField() tax_outcome = models.PositiveIntegerField() last_correct_answer = models.IntegerField() tasks_attempted = models.PositiveIntegerField(initial=0) tasks_correct = models.PositiveIntegerField(initial=0) matched = models.BooleanField() job_to_do_updated = models.BooleanField(initial=False) offers_dump = models.CharField() job_contract_dump = models.CharField() pay = models.CurrencyField() total_payoff = models.CurrencyField() def role(self): for each in self.session.vars['roles']: if self.id_in_group == each: return 'employer' if self.role != 'employer': return 'worker'
class Player(BasePlayer): id_profile = models.PositiveIntegerField(min=1) id_session = models.CharField(choices=['A', 'B', 'C', 'D', 'E', 'F'], widget=widgets.RadioSelect()) # id_born = models.PositiveIntegerField(choices=[ # [1,'A Milano'], # [2,'In Italia, ma non a Milano'], # [3,'Fuori dall’ Italia'], # ], # ) def permanent_var(self): self.participant.vars['id_profile'] = self.id_profile self.participant.vars['id_session'] = self.id_session # self.participant.vars['id_born'] = self.id_born my_country = models.CharField() my_gender = models.CharField()
class Player(BasePlayer): penny_side = models.CharField(choices=['Heads', 'Tails'], widget=widgets.RadioSelect()) is_winner = models.BooleanField() def role(self): if self.id_in_group == 1: return 'Mismatcher' if self.id_in_group == 2: return 'Matcher'
class Connection(djmodels.Model): class Meta: ordering = ['-created_at'] EVENT_TYPES = [('connected', 'CONNECTED'), ('disconnected', 'DISCONNECTED'), ('success_post', 'SUCCESS_POST')] created_at = models.DateTimeField(auto_now_add=True) participant = djmodels.ForeignKey(to=Participant) event_type = models.CharField(choices=EVENT_TYPES) def __str__(self): return 'Connection: {} for the participant {}'.format(self.event_type, self.participant.code)
class Player(BasePlayer): treatment = models.CharField(doc="Treatment of each player") endowment = models.CurrencyField(min=0, doc="endowment by each player") savings = models.CurrencyField( doc="Savings by each player", widget=widgets.RadioSelectHorizontal, label="How much do you want to invest in group energy conservation?" #,choices=currency_range(c(0), c(0.10), c(0.02)) ) financial_reward = models.FloatField(min=0) last_savings = models.CurrencyField(initial=0)
class Decision(Model ): # our custom model inherits from Django's base class "Model" player_decision = models.IntegerField(choices=Choices.choices_q123, initial=Choices.choices_q123[0]) related_question = models.CharField(choices=Choices.questions, initial=Choices.questions[0]) player = ForeignKey( Player ) # creates 1:m relation -> this decision was made by a certain player argument = ManyToManyField(Argument) # creates m:m relation