Example #1
0
class WidgetDemoForm(forms.Form):
    char = forms.CharField(required=False)

    text = forms.CharField(required=False, widget=forms.Textarea)

    radio_select = forms.ChoiceField(choices=default_choices,
                                     widget=forms.RadioSelect)
    radio_select_horizontal = forms.ChoiceField(
        choices=default_choices, widget=forms.RadioSelectHorizontal)
    checkbox_select = forms.MultipleChoiceField(
        choices=default_choices, widget=forms.CheckboxSelectMultiple)
    checkbox_select_horizontal = forms.MultipleChoiceField(
        choices=default_choices, widget=forms.CheckboxSelectMultipleHorizontal)

    currency = forms.CurrencyField()
    currency_choice = forms.CurrencyChoiceField(
        choices=[(m, m) for m in currency_range(0, 0.75, 0.05)])

    slider = forms.IntegerField(widget=widgets.SliderInput())
    unprecise_slider = forms.IntegerField(widget=widgets.SliderInput(
        show_value=False))
    precise_slider = forms.FloatField(widget=widgets.SliderInput(attrs={
        'min': 1,
        'max': 50,
        'step': 0.01
    }))
Example #2
0
class Player(otree.models.BasePlayer):

    # <built-in>
    group = models.ForeignKey(Group, null=True)
    subsession = models.ForeignKey(Subsession)
    # </built-in>

    name = models.CharField(max_length=255, verbose_name="Your name")

    age = models.CharField(max_length=255, verbose_name="Your age")

    email = models.EmailField(verbose_name="Your email address")

    gender = models.CharField(verbose_name="Are you",
                              max_length=255,
                              widget=widgets.RadioSelect(),
                              choices=["Male", "Female"])

    major = models.CharField(max_length=1000,
                             verbose_name="What is your major?")

    location_of_your_partners_influence_your_decisions = models.TextField(
        verbose_name=("Did the location of your partners influence your "
                      "decisions of how much to contribute to the individual "
                      "account versus the team account? If yes, how?"))

    working_in_a_location_of_their_choice_more_less_to_the_team = models.BooleanField(
        widget=widgets.RadioSelect(),
        verbose_name=("When you were partnered with two people working in a "
                      "location of their choice, did you want to give more "
                      "to the team or less than when you were partnered "
                      "with two people working in a lab?"))

    partners_in_location_their_choice_worked_harder_than_the_lab = models.BooleanField(
        widget=widgets.RadioSelect(),
        verbose_name=("Do you believe your partners participation in a "
                      "location of their choice gave more to the group than "
                      "your partners working the lab?"))

    I_work_best_in = models.CharField(
        verbose_name="Are you",
        max_length=255,
        widget=widgets.RadioSelect(),
        choices=["Structured environments", "flexible environments"])

    risks_in_everyday_life = models.PositiveIntegerField(
        min=1,
        max=10,
        widget=widgets.SliderInput(),
        verbose_name=("In general, do you take more or less risks in everyday "
                      "life? ('1' = take less risk and '10' take more risk.)"))

    risks_in_financial_decision = models.PositiveIntegerField(
        min=1,
        max=10,
        widget=widgets.SliderInput(),
        default=5,
        verbose_name=
        (" In general, do you take more or less risks in financial decisions? "
         "life? ('1' = take less risk and '10' take more risk.)"))
Example #3
0
class Player(BasePlayer):

    # form showing whether a player approves government's reforms
    approval_choices = ((1, "Одобряю"),(0, "Не одобряю"))
    approval = models.FloatField(widget=widgets.RadioSelect, choices=approval_choices)
    approval_final = models.FloatField(widget=widgets.RadioSelect, choices=approval_choices)

    # form showing how much a player is spending on trying to overthrow the system
    vote_to_overthrow = models.FloatField(widget=widgets.SliderInput(attrs={'step': '1'}), min=0, max=Constants.max_overthrow_vote_for_player, default=3)

    # form showing how much reforms a player desires after the overthrow
    reforms_votes = models.FloatField(widget=widgets.SliderInput(attrs={'step': '1'}), min=0, max=Constants.max_reforms, default=3)
Example #4
0
class FormFieldModel(otree.models.BaseGroup):
    null_boolean = models.BooleanField()
    big_integer = models.BigIntegerField()
    boolean = models.BooleanField(default=False)
    char = models.CharField()
    comma_separated_integer = models.CommaSeparatedIntegerField(max_length=100)
    date = models.DateField()
    date_time = models.DateTimeField()
    alt_date_time = models.DateTimeField(
        widget=otree.forms.SplitDateTimeWidget)
    decimal = models.DecimalField(max_digits=5, decimal_places=2)
    email = models.EmailField()
    file = models.FileField(upload_to='_tmp/uploads')
    file_path = models.FilePathField()
    float = models.FloatField()
    integer = models.IntegerField()
    generic_ip_address = models.GenericIPAddressField()
    positive_integer = models.PositiveIntegerField()
    positive_small_integer = models.PositiveSmallIntegerField()
    slug = models.SlugField()
    small_integer = models.SmallIntegerField()
    text = models.TextField()
    alt_text = models.TextField(widget=otree.forms.TextInput)
    time = models.TimeField()
    url = models.URLField()
    many_to_many = models.ManyToManyField('SimpleModel', related_name='+')
    one_to_one = models.OneToOneField('SimpleModel', related_name='+')

    currency = models.CurrencyField()
    currency_choice = models.CurrencyField(choices=[('0.01',
                                                     '0.01'), ('1.20',
                                                               '1.20')])

    sent_amount = models.CurrencyField(choices=currency_range(0, 0.75, 0.05))
    slider_widget = models.IntegerField(widget=widgets.SliderInput())
Example #5
0
class Player(BasePlayer):

    q2_communication_surprised = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_communication_satisfied = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_communication_upset = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_how_did_you_talk_about_the_cleaning = models.CharField(
        max_length=255,  widget=widgets.RadioSelect(),
        choices=["The group created strict rules when to clean.",
                 "More or less rules when to clean.",
                 "Several cleaning possibilities were mentioned without staying with one.",
                 "Without cleaning possibilites given by the group members, I found myself easier doing it next time better.",
                 "Cleaning behaviors were mentioned without helping me judge how to improve next time.",
                 "The issure 'Toilet cleaning' or behavior in game wasn't mentioned at all."])

    q2_recomendation_for_actions = models.TextField()
    q2_communication_helped_positive_and_negative = models.TextField()

    q2_opinion_recomendation_everyone = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_opinion_recomendation_fair = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_opinion_recomendation_max_resources = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_opinion_recomendation_understandable = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))

    q2_pressure_behaving_like_settled_rules = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))

    q2_would_it_disturb_you_behaving_differently = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))

    q2_is_there_any_kind_of_social_pressure = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))

    q2_i_will_follwow_the_recommendation_entirely = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_i_will_follwow_the_recommendation_maximizing_my_advantage = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))

    q2_others_follow_the_recommendations_entirely = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_others_follow_the_recommendations_try_to_max_their_advantage = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))

    q2_how_much_cooperate_because_communication = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_team_spirit = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_afterc_importance_of_your_image = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_afterc_importance_maximum_resources_to_everyone = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_afterc_importance_other_members_trust_in_you = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_afterc_importance_maximum_resources_to_everyone_not_you = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_afterc_how_much_trust_do_you_have_into_other_members = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_afterc_how_much_do_you_like_the_other_team_members = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_afterc_how_good_you_understand_solving_problem_max_resources = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_afterc_others_understand_solving_problem_great_max_resources = models.PositiveIntegerField(min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_which_strategy_would_you_follow_and_why = models.TextField()
Example #6
0
class Player(BasePlayer):

    debriefing_guess_which_group = models.CharField(
        max_length=255,
        widget=widgets.RadioSelect(),
        choices=[
            'Gruppe mit Anweisungen für alle zu positiver Kommunikation',
            'Gruppe mit Konfident mit positiver Kommunikation',
            'Gruppe mit Konfident mit negativer Kommunikation',
            'Kontrollgruppe ohne eigentliche Anweisungen', 'Weiss nicht'
        ])

    debriefing_sure_about_confidant_in_group = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))

    debriefing_who_was_confidant = models.CharField(
        max_length=255, widget=widgets.RadioSelect(), choices=[])

    what_made_you_assume_confidant = models.TextField(default='n/a')
    debriefing_feedback = models.TextField()

    # confidant
    confidant_debriefing_feedback = models.TextField()
Example #7
0
class Player(BasePlayer):
    sex = models.IntegerField(initial=None,
                              choices=[(1, 'Femme'), (0, 'Homme')],
                              verbose_name='Sexe',
                              widget=widgets.RadioSelect())
    sisters_brothers = models.IntegerField(
        initial=None,
        choices=[(1, 'Oui'), (0, 'Non')],
        verbose_name='Avez-vous des frères et soeurs',
        widget=widgets.RadioSelect())
    religion = models.IntegerField(initial=None,
                                   choices=[(0, 'Catholique'), (1, 'Juive'),
                                            (2, 'Musulmane'),
                                            (3, 'Protestante'),
                                            (4, 'Autres religions'),
                                            (5, 'Aucune')],
                                   verbose_name='Religion',
                                   widget=widgets.RadioSelect())
    religion_practice = models.IntegerField(
        initial='0',
        verbose_name=
        'Pratiquez-vous régulièrement votre religion ? (de 0: Jamais,'
        'à 5: Toujours)',
        widget=widgets.SliderInput(attrs={
            'step': '1',
            'min': '0',
            'max': '5'
        }))
    student = models.IntegerField(initial=None,
                                  choices=[(1, 'Oui'), (0, 'Non')],
                                  verbose_name='Etes-vous étudiant(e) ?',
                                  widget=widgets.RadioSelect())
    field_of_studies = models.IntegerField(
        initial=None,
        choices=[(0, 'Economie-Gestion'), (1, 'Droit'),
                 (2, 'Sciences politiques'), (3, 'Psychologie'),
                 (4, 'Autres sciences sociales'), (5, 'Mathématiques'),
                 (6, 'Sciences'), (7, 'Autres')],
        verbose_name=
        'Discipline étudiée (actuellement ou lorsque vous étiez étudiant(e)) ?',
        widget=widgets.RadioSelect())
    level_of_study = models.IntegerField(initial=None,
                                         choices=[
                                             (0, 'Licence'), (1, 'Master'),
                                             (2, 'Doctorat'), (3, 'Autres')
                                         ],
                                         verbose_name="Niveau d'études",
                                         widget=widgets.RadioSelect())
    couple = models.IntegerField(initial=None,
                                 choices=[(1, 'Oui'), (0, 'Non')],
                                 verbose_name='Etes-vous en couple ?',
                                 widget=widgets.RadioSelect())
    previous_participation = models.IntegerField(
        initial=None,
        choices=[(1, 'Oui'), (0, 'Non')],
        verbose_name=
        'Avez-vous déjà participé à une expérience en laboratoire ?',
        widget=widgets.RadioSelect())
    boring_task = models.IntegerField(
        initial=None,
        choices=[(0, 'Très ennuyeuses'), (1, 'Plutot ennuyeuses'),
                 (2, 'Peu ennuyeuses'), (3, 'Pas du tout ennuyeuses')],
        verbose_name=
        "Selon vous, les tâches que vous avez accomplies au début de "
        "l'expérience (le curseur qui devait être placé au milieu d'un trait) "
        "étaient ?",
        widget=widgets.RadioSelect())
    risk_aversion = models.IntegerField(
        initial='0',
        choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        widget=widgets.RadioSelectHorizontal())

    confiance = models.IntegerField(
        initial=None,
        choices=[(0, 'Je ne sais pas'), (1, 'On n’est jamais trop prudent '),
                 (2, 'La plupart des gens sont dignes de confiance')],
        verbose_name=
        "Généralement parlant, direz-vous que la plupart des gens sont dignes de confiance ou que l’on n’est jamais trop prudent avec les gens ?",
        widget=widgets.RadioSelect())
    groupe = models.IntegerField(
        choices=[(0, 'A'), (1, 'B'), (2, 'C'), (3, 'D'), (4, 'E'), (5, 'F'),
                 (6, 'G')],
        verbose_name=
        "Veuillez indiquer dans quelle mesure vous vous sentez envers les autres membres de votre groupe de la partie 2.",
    )
Example #8
0
class Player(BasePlayer):

    vcm_round = models.PositiveIntegerField(doc='The vcm round number.')

    individual_exchange = models.FloatField(
        initial=None,
        verbose_name='Individual exchange:',
        doc="Individual exchange contribution in this round")

    group_exchange = models.FloatField(
        initial=None,
        verbose_name='Group exchange:',
        doc="Group exchange contribution in this round")

    group_exchange_percent = models.FloatField(
        min=5,
        max=95,
        blank=True,  #not required
        doc=
        "in this round, this subject's percent contribution to group exchange relative to total amount availale to user",
        widget=widgets.SliderInput(attrs={
            'step': '1',
            'value': '5'
        }))

    total_op_individual_exchange = models.FloatField(
        doc='total individual_exchange contributions of opposing players')

    total_op_group_exchange = models.FloatField(
        doc='total group_exchange contributions of opposing players')
    round_points = models.FloatField(
        doc='Points earned this round from the VCM')

    player_role = models.CharField(doc="player type, A or F")

    player_role_list = models.CharField(
        doc=
        "list of all player roles after assignment. index 0 -> P1, index 1 -> P2"
    )

    paid_round = models.PositiveIntegerField(doc='vmc period that is paid on')

    final_score = models.FloatField(
        doc="this palyer's final score in this round")

    final_ge = models.PositiveIntegerField(
        doc=
        "this player's final group exchange contribution in the randomly chosen round"
    )

    def set_payoffs(self):
        """calc player payoffs"""
        self.total_op_individual_exchange = sum(
            [p.individual_exchange for p in self.get_others_in_group()])
        self.total_op_group_exchange = sum(
            [p.group_exchange for p in self.get_others_in_group()])

        self.round_points = self.individual_exchange - (
            1 / 2) * self.total_op_individual_exchange + (
                1 / 2) * self.group_exchange + Constants.automatic_earnings

    def set_roles(self, overall_ge_percent_list):
        """set player roles"""

        own_id_index = self.id_in_group - 1

        # rank 1 and 2 are smallest ge%
        # rank 3 and 4 are biggest ge contributers (check out scipy.stats `rankdata` for details)
        if (np.where(
                rankdata(np.array(overall_ge_percent_list), method='ordinal')
                == 4)[0] == own_id_index):
            self.player_role = self.participant.vars['Role'] = "A"
        elif (np.where(
                rankdata(np.array(overall_ge_percent_list), method='ordinal')
                == 3)[0] == own_id_index):
            self.player_role = self.participant.vars['Role'] = "A"
        else:
            self.player_role = self.participant.vars['Role'] = "F"

        # set player_role_list, a log of each player's role
        player_role_list = []
        for id_ in range(0, len(overall_ge_percent_list)):
            if (np.where(
                    rankdata(np.array(overall_ge_percent_list),
                             method='ordinal') == 4)[0] == id_):
                player_role_list.append("A")
            elif (np.where(
                    rankdata(np.array(overall_ge_percent_list),
                             method='ordinal') == 3)[0] == id_):
                player_role_list.append("A")
            else:
                player_role_list.append("F")

        self.player_role_list = self.participant.vars[
            'player_role_list'] = player_role_list  #just for debugging, might delete  self.participant.vars['player_role_list'] later.

        #this is the key var passed to stage game.
        self.participant.vars[
            'player_role_list'] = player_role_list  #used to get roles in stage game.
        self.participant.vars[
            'overall_ge_percent_list'] = overall_ge_percent_list
        self.participant.vars['overall_ge_percent'] = overall_ge_percent_list[
            own_id_index]
Example #9
0
class Player(BasePlayer):

    q2_communication_surprised = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_communication_satisfied = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_communication_upset = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_fair_discussion = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_fear_criticism = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_communication_to_be_right = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_give_opinion = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_others_opinions = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_communication_whine = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_inputs_considered = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_best_player = models.CharField(max_length=255,
                                      widget=widgets.RadioSelect(),
                                      choices=[])
    q2_communication_focused = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_communication_efficient = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_communication_interested_in_solution = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q2_discussion_tense = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_discussion_tense_why = models.TextField()
    q2_chat_instructions_helpful = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_chat_instructions_followed = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_was_there_negative_participant = models.CharField(
        max_length=255, widget=widgets.RadioSelect(), choices=['Ja', 'Nein'])
    q2_negative_participant = models.TextField(
        default='Fügen Sie hier die Spielernamen hinzu.')
    q2_was_there_positive_participant = models.CharField(
        max_length=255, widget=widgets.RadioSelect(), choices=['Ja', 'Nein'])
    q2_positive_participant = models.TextField(
        default='Fügen Sie hier die Spielernamen hinzu.')

    # confidant
    q2_confidant_followed_chat_intstructions = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_confidant_difficulty_chat_instructions = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_confidant_problems_chat_instructions = models.TextField()
    q2_confidant_others_found_out_confidant = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_confidant_others_found_out_confidant_why = models.TextField()
    q2_confidant_pleased_about_being_chosen = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_confidant_would_have_participated_if_knew = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_confidant_comments_in_general = models.TextField()
    q2_confidant_influence_inputs = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_confidant_inputs_being_ignored_others = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q2_confidant_cleaning_how_to_proceed = models.CharField(
        max_length=255,
        widget=widgets.RadioSelect(),
        choices=[
            'Die Gruppe einigte sich auf klare Regeln, wie sich jeder im Spiel verhalten soll.',
            'Es wurde vage vereinbart, wie sich jeder im Spiel verhalten soll.',
            'Verschiedene Möglichkeiten, wie sich jeder im Spiel verhalten soll, wurden angesprochen, aber es kam nie zu einer Einigung auf eine der Möglichkeiten.',
            'Obschon keine konkreten Möglichkeiten genannt wurden, wie sich jeder im Spiel verhalten soll wurde mir klarer, wie ich meine Entscheidungen verbessern könnte.',
            'Es wurde zwar über das Reinigen bzw. Verhalten im Spiel geredet, dies hatte aber keinen Bezug darauf, wie man in weiteren Spielen handeln soll.',
            'Das Thema \'Toilettenreinigung\' bzw. Verhalten im Spiel wurde gar nicht angesprochen'
        ])

    q2_confidant_how_to_realize_recommendations = models.TextField()
Example #10
0
class Player(BasePlayer):
    # pratice sliders
    practice_slider_value_one = models.IntegerField(widget=widgets.SliderInput(
        attrs={
            'step': '1',
            'min': '0',
            'max': '100'
        }))
    practice_slider_value_two = models.IntegerField(widget=widgets.SliderInput(
        attrs={
            'step': '1',
            'min': '0',
            'max': '100'
        }))

    # input from player
    player_slider_value_one = models.IntegerField(widget=widgets.SliderInput(
        attrs={
            'step': '1',
            'min': '0',
            'max': '100'
        }))
    player_slider_value_two = models.IntegerField(widget=widgets.SliderInput(
        attrs={
            'step': '1',
            'min': '0',
            'max': '100'
        }))
    player_slider_value_three = models.IntegerField(widget=widgets.SliderInput(
        attrs={
            'step': '1',
            'min': '0',
            'max': '100'
        }))
    player_slider_value_four = models.IntegerField(widget=widgets.SliderInput(
        attrs={
            'step': '1',
            'min': '0',
            'max': '100'
        }))
    player_slider_value_five = models.IntegerField(widget=widgets.SliderInput(
        attrs={
            'step': '1',
            'min': '0',
            'max': '100'
        }))
    player_slider_value_six = models.IntegerField(widget=widgets.SliderInput(
        attrs={
            'step': '1',
            'min': '0',
            'max': '100'
        }))
    player_slider_value_seven = models.IntegerField(widget=widgets.SliderInput(
        attrs={
            'step': '1',
            'min': '0',
            'max': '100'
        }))
    player_slider_value_eight = models.IntegerField(widget=widgets.SliderInput(
        attrs={
            'step': '1',
            'min': '0',
            'max': '100'
        }))
    player_slider_value_nine = models.IntegerField(widget=widgets.SliderInput(
        attrs={
            'step': '1',
            'min': '0',
            'max': '100'
        }))
    player_slider_value_ten = models.IntegerField(widget=widgets.SliderInput(
        attrs={
            'step': '1',
            'min': '0',
            'max': '100'
        }))

    # practice random value
    practice_random_slider_value_one = models.IntegerField()
    practice_random_slider_value_two = models.IntegerField()

    # correct values
    random_slider_value_one = models.IntegerField()
    random_slider_value_two = models.IntegerField()
    random_slider_value_three = models.IntegerField()
    random_slider_value_four = models.IntegerField()
    random_slider_value_five = models.IntegerField()

    random_slider_value_six = models.IntegerField()
    random_slider_value_seven = models.IntegerField()
    random_slider_value_eight = models.IntegerField()
    random_slider_value_nine = models.IntegerField()
    random_slider_value_ten = models.IntegerField()

    correct_sliders = models.IntegerField()
Example #11
0
class Player(otree.models.BasePlayer):

    # <built-in>
    group = models.ForeignKey(Group, null=True)
    subsession = models.ForeignKey(Subsession)
    # </built-in>

    player_name = models.CharField(max_length=255)
    avatar = models.CharField(max_length=255)

    genero = models.CharField(
        max_length=30, widget=widgets.RadioSelectHorizontal(),
        choices=[Constants.hombre, Constants.mujer], verbose_name="Seleccióne su género")

    # bloque 1
    block_1_last_question_clicked = models.IntegerField(default=0, widget=widgets.HiddenInput())

    satisfecho_con_la_vida = models.PositiveIntegerField(
        verbose_name=(
            "En una escala del 1 al 10, donde 1 es nada satisfecho y 10 "
            "totalmente satisfecho, en general ¿qué tan satisfecha(o) se "
            "encuentra usted con su vida? Usted puede escoger cualquier "
            "número entre 1 y 10."), choices=range(1,11),
            widget=widgets.RadioSelectHorizontal(), default=1)

    cuartos_en_el_hogar = models.PositiveIntegerField(
        widget=widgets.SliderInput(), max=20,
        verbose_name=("¿Cuántos cuartos hay en su hogar sin contar pasillos, ni baños?"), min=1, default=1)

    cuantos_cuartos_se_usan_para_dormir = models.PositiveIntegerField(
        widget=widgets.SliderInput(), max=20,
        verbose_name=("Y de esos cuartos, ¿cuántos usan para dormir?"), min=1, default=1)

    habitantes = models.PositiveIntegerField(
        widget=widgets.SliderInput(), max=20,
        verbose_name=("¿Cuántas personas viven en su hogar contando ancianos y niños?"), min=1, default=1)

    focos = models.PositiveIntegerField(
        widget=widgets.SliderInput(), max=50,
        verbose_name=(
            "Contando todos los focos que utiliza para iluminar su hogar, "
            "incluyendo los de techos, paredes y lámparas de buró o piso, "
            "dígame, ¿Cuántos focos tiene en su vivienda?"), min=1, default=1)

    con_quien_vive = models.CharField(
        verbose_name=("¿Con quién vive actualmente?"), max_length=255, default="---",
        choices=["---", "Solo", "Con una pareja", "Con amigos", "Con esposo(a)", "Con familia", "Otro"])

    cuenta_con_automovil = models.BooleanField(
        verbose_name=("Automóvil propio excluyendo taxis"),
        widget=widgets.RadioSelectHorizontal(), default=False)
    cuantos_automovil = models.PositiveIntegerField(default=0)

    cuenta_con_televisor = models.BooleanField(
        verbose_name=("Televisor"),
        widget=widgets.RadioSelectHorizontal(), default=False)
    cuantos_televisor = models.PositiveIntegerField(default=0)

    cuenta_con_celular = models.BooleanField(
        verbose_name=("Teléfono Celular"),
        widget=widgets.RadioSelectHorizontal(), default=False)
    cuantos_celular = models.PositiveIntegerField(default=0)

    cuenta_con_computadora = models.BooleanField(
        verbose_name=("Computadora de escritorio o portátil"),
        widget=widgets.RadioSelectHorizontal(), default=False)
    cuantos_computadora = models.PositiveIntegerField(default=0)

    cuenta_con_bano = models.BooleanField(
        verbose_name=("Baño completo con regadera y excusado para uso exclusivo del hogar"),
        widget=widgets.RadioSelectHorizontal(), default=False)
    cuantos_bano = models.PositiveIntegerField(default=0)

    cuenta_con_servidumbre = models.BooleanField(
        verbose_name=("Personas de servicio doméstico como limpieza, jardinero o chofer"),
        widget=widgets.RadioSelectHorizontal(), default=False)
    cuantos_servidumbre = models.PositiveIntegerField(default=0)

    tarjeta_de_credito = models.BooleanField(
        verbose_name=("Cuenta usted con tarjeta de crédito"),
        widget=widgets.RadioSelectHorizontal(), default=False)

    altura = models.FloatField(
        verbose_name=("Aproximadamente, ¿qué estatura tiene usted? (en metros)"),
        min=0, widget=widgets.SliderInput(attrs={'step': '0.01', 'max': '2.5'}), default=0)

    peso = models.PositiveIntegerField(
        verbose_name=("Aproximadamente, ¿qué peso tiene usted? (en kilogramos)"),
        min=0, max=200, widget=widgets.SliderInput(), default=0)

    ejercicio_fisico = models.BooleanField(
        verbose_name=("Durante las últimas dos semanas, ¿ha realizado usted ejercicio físico fuera del trabajo?"),
        widget=widgets.RadioSelectHorizontal(), default=False)

    cigarrillo = models.BooleanField(
        verbose_name=("Durante las últimas dos semanas, ¿ha fumado algún cigarrillo o puro?"),
        widget=widgets.RadioSelectHorizontal(), default=False)

    vive_con_padre = models.BooleanField(
        widget=widgets.RadioSelectHorizontal(), default=False)
    vive_con_madre = models.BooleanField(
        widget=widgets.RadioSelectHorizontal(), default=False)

    edad_padre = models.PositiveIntegerField(
        choices=range(30, 101), default=30)
    edad_madre = models.PositiveIntegerField(
        choices=range(30, 101), default=30)

    padre_habla_dialecto_indigena = models.BooleanField(
        widget=widgets.RadioSelectHorizontal(), default=False)
    madre_habla_dialecto_indigena = models.BooleanField(
        widget=widgets.RadioSelectHorizontal(), default=False)

    padre_habla_lengua_extranjera = models.BooleanField(
        widget=widgets.RadioSelectHorizontal(), default=False)
    madre_habla_lengua_extranjera = models.BooleanField(
        widget=widgets.RadioSelectHorizontal(), default=False)

    nivel_educacion_padre = models.CharField(
        choices=["---", "Primaria", "Secundaria", "Preparatoria", "Universitario"],
        max_length=50, default="---")
    nivel_educacion_madre = models.CharField(
        choices=["---", "Primaria", "Secundaria", "Preparatoria", "Universitario"],
        max_length=50, default="---")

    # bloque 2
    block_2_last_question_clicked = models.IntegerField(default=0, widget=widgets.HiddenInput())

    riqueza_hogar_14_anios = models.PositiveIntegerField(
        widget=widgets.RadioSelectHorizontal(),
        verbose_name=(
            "Comparando el hogar donde vivía a los 14 años con todos los "
            "hogares actuales de México y usando una escala de 1 a 10, en la "
            "que 1 son los hogares más pobres y 10 son los más ricos, ¿dónde "
            "pondría usted su hogar de ese entonces?"),
        choices=range(1, 11), default=1)

    TRABAJOS = ("---", "Patrón o empleador ", "Trabajador por cuenta propia ",
            "Empleado u obrero del sector público",
            "Empleado u obrero del sector privado", "Servicio Doméstico (por pago)",
            "Quehaceres del hogar (sin pago) ", "Trabajador sin pago ",
            "Fuerzas armadas y del orden")

    padre_trabajaba_14_anios = models.BooleanField(widget=widgets.RadioSelectHorizontal(), default=False)
    madre_trabajaba_14_anios = models.BooleanField(widget=widgets.RadioSelectHorizontal(), default=False)
    padre_ocupacion_14_anios = models.CharField(max_length=255, choices=TRABAJOS, default=TRABAJOS[0])
    madre_ocupacion_14_anios = models.CharField(max_length=255, choices=TRABAJOS, default=TRABAJOS[0])
    padre_trabajo_servicios_medicos_14_anios = models.BooleanField(widget=widgets.RadioSelectHorizontal(), default=False)
    madre_trabajo_servicios_medicos_14_anios = models.BooleanField(widget=widgets.RadioSelectHorizontal(), default=False)

    CON_QUIEN_VIVIA = (
        "---", "Solo con el padre", "Solo con la madre",
        "Con ambos, padre y madre", "Con otra familia", "Otra persona")
    con_quien_vivia_14_anios = models.CharField(
        verbose_name=("Cuando usted tenía alrededor de 14 años ¿con quién vivía?"),
        choices=CON_QUIEN_VIVIA, default=CON_QUIEN_VIVIA[0], max_length=255)

    MUCHO_REGULAR_POCO_NADA = ["---", "Mucho", "Regular", "Poco", "Nada"]
    padre_emocionalmente_cerano_14_anios = models.CharField(
        max_length=20, choices=MUCHO_REGULAR_POCO_NADA, default=MUCHO_REGULAR_POCO_NADA[0])
    madre_emocionalmente_cerano_14_anios = models.CharField(
        max_length=20, choices=MUCHO_REGULAR_POCO_NADA, default=MUCHO_REGULAR_POCO_NADA[0])
    padre_entendia_problemas_14_anios = models.CharField(
        max_length=20, choices=MUCHO_REGULAR_POCO_NADA, default=MUCHO_REGULAR_POCO_NADA[0])
    madre_entendia_problemas_14_anios = models.CharField(
        max_length=20, choices=MUCHO_REGULAR_POCO_NADA, default=MUCHO_REGULAR_POCO_NADA[0])
    padre_actividades_escolares_14_anios = models.CharField(
        max_length=20, choices=MUCHO_REGULAR_POCO_NADA, default=MUCHO_REGULAR_POCO_NADA[0])
    madre_actividades_escolares_14_anios = models.CharField(
        max_length=20, choices=MUCHO_REGULAR_POCO_NADA, default=MUCHO_REGULAR_POCO_NADA[0])
    padre_actividades_tiempo_libre_14_anios = models.CharField(
        max_length=20, choices=MUCHO_REGULAR_POCO_NADA, default=MUCHO_REGULAR_POCO_NADA[0])
    madre_actividades_tiempo_libre_14_anios = models.CharField(
        max_length=20, choices=MUCHO_REGULAR_POCO_NADA, default=MUCHO_REGULAR_POCO_NADA[0])
    padre_reglas_claras_14_anios = models.CharField(
        max_length=20, choices=MUCHO_REGULAR_POCO_NADA, default=MUCHO_REGULAR_POCO_NADA[0])
    madre_reglas_claras_14_anios = models.CharField(
        max_length=20, choices=MUCHO_REGULAR_POCO_NADA, default=MUCHO_REGULAR_POCO_NADA[0])

    relacion_padres_14_anios = models.CharField(
        verbose_name=("¿La relación entre sus padres generalmente era: excelente, buena, regular, mala o muy mala?"),
        max_length=20, default="---",
        choices=["---", "Excelente", "Buena", "Regular", "Mala", "Muy mala"])

    FAMILIA_FRECUENCIA = ("Siempre", "Frecuentemente", "Pocas veces", "Nunca", "Omitir")
    familia_frecuencia_insultos_14_anios = models.CharField(
        verbose_name=("¿Con qué frecuencia ocurrían INSULTOS, GRITOS o AMENAZAS en su familia?"),
        max_length=20, choices=FAMILIA_FRECUENCIA, default=FAMILIA_FRECUENCIA[-1])
    familia_frecuencia_cercania_14_anios = models.CharField(
        verbose_name=("¿Con qué frecuencia los miembros de su familia se sentían muy cercanos los unos de los otros?"),
        max_length=20, choices=FAMILIA_FRECUENCIA, default=FAMILIA_FRECUENCIA[-1])
    frequencia_miedos_14_anios = models.CharField(
        verbose_name=("¿Con qué frecuencia la/lo molestaban miedos o preocupaciones?"),
        max_length=20, choices=FAMILIA_FRECUENCIA, default=FAMILIA_FRECUENCIA[-1])

    madre_trabajo_por_ingreso_desde_que_nacio = models.BooleanField(
        verbose_name=("¿Su madre trabajo por un ingreso en algún momento desde que usted nació hasta el día de hoy?"),
        widget=widgets.RadioSelectHorizontal(), default=False)

    madre_trabajo_periodos_de_su_vida_0_4_anios = models.BooleanField(
        verbose_name=("0 a 4 años de edad"), widget=widgets.RadioSelectHorizontal(), default=False)

    madre_trabajo_periodos_de_su_vida_5_9_anios = models.BooleanField(
        verbose_name=("5 a 9 años de edad"), widget=widgets.RadioSelectHorizontal(), default=False)

    madre_trabajo_periodos_de_su_vida_10_14_anios = models.BooleanField(
        verbose_name=("10 a 14 años de edad"), widget=widgets.RadioSelectHorizontal(), default=False)

    madre_trabajo_periodos_de_su_vida_15_19_anios = models.BooleanField(
        verbose_name=("15 a 19 años de edad"), widget=widgets.RadioSelectHorizontal(), default=False)

    tiene_hermanos = models.BooleanField(
        verbose_name=("¿Tiene usted hermanos o hermanas?"),
        widget=widgets.RadioSelectHorizontal(), default=False)

    numero_de_hermano_que_es_usted = models.PositiveIntegerField(
        verbose_name=(
            "Ahora piense en sus hermanos ordenándolos del mayor al menor "
            "aunque hayan fallecido y dígame qué número de hermano es usted."),
        choices=range(1, 11), default=1, widget=widgets.RadioSelectHorizontal())

    HERMANOS_1_10 = ["---"] + [str(i) for i in range(1, 11)]
    hermanos_que_son = models.CharField(choices=HERMANOS_1_10, max_length=10, default=HERMANOS_1_10[0])
    hermanas_que_son = models.CharField(choices=HERMANOS_1_10, max_length=10, default=HERMANOS_1_10[0])
    hermanos_viven_con_usted_actualmente = models.CharField(choices=HERMANOS_1_10, max_length=10, default=HERMANOS_1_10[0])
    hermanas_viven_con_usted_actualmente = models.CharField(choices=HERMANOS_1_10, max_length=10, default=HERMANOS_1_10[0])
    hermanos_trabajan_por_pago_actualmente = models.CharField(choices=HERMANOS_1_10, max_length=10, default=HERMANOS_1_10[0])
    hermanas_trabajan_por_pago_actualmente = models.CharField(choices=HERMANOS_1_10, max_length=10, default=HERMANOS_1_10[0])

    espera_trabajar_remonerado_mayor_parte_de_su_vida = models.BooleanField(
        widget=widgets.RadioSelectHorizontal(),
        verbose_name=("¿Espera usted trabajar de forma remunerada la mayor parte de su vida?"), default=False)

    TRABAJO_FUTURO = [
        "---", "Asalariado", "Auto-empleado", "Dueño de negocio",
        "Dueño de empresa", "Ninguna de las anteriores"]
    de_que_manera_espera_trabajar = models.CharField(
        verbose_name="¿De qué manera espera trabajar?",
        choices=TRABAJO_FUTURO, max_length=100, default=TRABAJO_FUTURO[0])

    cuanto_cree_que_ganaria_en_30_anios = models.PositiveIntegerField(
        widget=widgets.SliderInput(), max=100000,
        verbose_name=(
            "Imagine que usted tiene 30 años el día de hoy y está trabajando "
            "de forma remunerada. ¿Cuánto cree que ganaría al mes por su trabajo?"), default=0)

    cree_que_tendra_hijo = models.CharField(
        verbose_name="Cree que usted tenga un hijo en algún momento de la vida?",
        choices=["---", "Si", "No", "Ya lo tuvo"], max_length=100, default="---")

    edad_de_primer_hijo = models.PositiveIntegerField(
        verbose_name=("¿A qué edad espera tener su primer hijo?"), choices=range(1, 100), default=0)

    edad_tuvo_primer_hijo = models.PositiveIntegerField(
        verbose_name=("¿A qué edad tuvo a su primer hijo?"), choices=range(1, 100), default=0)

    # BLOQUE 3
    block_3_last_question_clicked = models.IntegerField(default=0, widget=widgets.HiddenInput())

    RANGO_1_10 = range(1, 11)

    hogar_actual_vs_mexico = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Comparando su hogar actual con todos los hogares actuales de México y usando una escala de 1 a 10, en la que 1 son los hogares más pobres y 10 son los más ricos, ¿dónde pondría usted su hogar actual?"))

    cuanto_depende_de_usted_que_le_vaya_bien = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("En una escala del 1 al 10, donde 1 es “nada depende de usted” y 10 es “todo depende de usted”, ¿qué tanto depende de usted misma(o) que le vaya bien en este año y el próximo?"))

    gobierno_o_sociedad_pobreza = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0],
        widget=widgets.RadioSelectHorizontal(), verbose_name=("Pobreza"))
    gobierno_o_sociedad_delincuencia = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0],
        widget=widgets.RadioSelectHorizontal(), verbose_name=("Delincuencia"))
    gobierno_o_sociedad_narcotrafico = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0],
        widget=widgets.RadioSelectHorizontal(), verbose_name=("Narcotráfico"))
    gobierno_o_sociedad_corrupcion = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0],
        widget=widgets.RadioSelectHorizontal(), verbose_name=("Corrupción"))
    gobierno_o_sociedad_educacion = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0],
        widget=widgets.RadioSelectHorizontal(), verbose_name=("Mala o Poca Educación"))
    gobierno_o_sociedad_discriminacion = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0],
        widget=widgets.RadioSelectHorizontal(), verbose_name=("Discriminación"))
    gobierno_o_sociedad_adicciones_y_enfermedades = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0],
        widget=widgets.RadioSelectHorizontal(), verbose_name=("Atención de adicciones y enfermedades"))

    dispuesto_a_tomar_riesgos = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("En una escala del 1 al 10, donde 1 es nada dispuesto y 10 totalmente dispuesto, ¿qué tan dispuesto está a tomar riesgos?"))

    describe_como_persona_abstengo_hacer_cosas_hoy = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Me abstengo de cosas hoy para poder tener más mañana"))
    describe_como_persona_retrazo_cosas = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Tiendo a retrasar cosas aun cuando sería mejor hacerlas de una vez"))
    describe_como_persona_asumo_gente_tiene_mejores_intenciones = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Mientras no esté convencido de lo contrario, siempre asumo que la gente tiene las mejores intenciones"))
    describe_como_persona_no_entiendo_pelea_no_le_beneficia = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("No entiendo por qué alguna gente dedica su vida a pelear por una causa que no les beneficia directamente"))
    describe_como_persona_ayudo_al_que_me_ayudo = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Realizo un gran esfuerzo para ayudar a alguien que me ha ayudado antes"))
    describe_como_persona_me_vengo = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Si alguien me hace algo malo a propósito, trataré de regresárselo"))

    que_tan_impulsivo_se_considera = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("En una escala del 1 al 10, donde 1 es totalmente y 10 es nada, ¿qué tan impulsivo se considera?"))

    dispuesto_a_confiar = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Confiar en otras personas"))
    dispuesto_a_compartir = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Compartir algo con otras personas sin nada a cambio"))
    dispuesto_a_regresar_favor = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Regresar un favor a un extraño"))
    dispuesto_a_castigar = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Castigar a alguien debido a una conducta injusta aun cuando es costoso. Ej. Decirle a una persona que no tire basura en la calle aun cuando esa persona se puede enojar y decirle algo."))

    que_tan_paciente_se_considera = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("En una escala del 1 al 10, donde 1 es muy paciente y 10 es muy impaciente, ¿qué tan paciente o impaciente se considera? Usted puede escoger cualquier número entre 1 y 10."))

    acuerdo_con_educacion_genera_ingreso = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("El nivel educativo determina el nivel de ingreso de una persona"))
    acuerdo_con_hombres_mas_trabajo_que_mujeres = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Cuando no hay mucho trabajo, los hombres deberían de tener preferencia a un trabajo antes que las mujeres"))
    acuerdo_con_esposa_que_gana_mas_genera_dinero = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("La esposa que gana más dinero que el esposo genera problemas"))
    acuerdo_con_no_se_puede_confiar_en_nadie = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Hoy en día, no se puede confiar en nadie más"))
    acuerdo_con_camino_de_mi_vida = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("El camino de mi vida depende de mí"))
    acuerdo_con_he_logrado_lo_que_merezco = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("En comparación con otros, no he logrado lo que merezco"))
    acuerdo_con_logros_suerte = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Lo que se logra en la vida es principalmente una cuestión de destino o suerte"))
    acuerdo_con_otros_deciden_por_mi = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Frecuentemente tengo la sensación de que otros toman decisiones sobre mi vida"))
    acuerdo_con_puedo_influir_en_condicion_social = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Si uno es social o políticamente activo, se puede influir en las condiciones sociales"))
    acuerdo_con_trabajar_duro_exito = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Hay que trabajar duro para alcanzar el éxito"))
    acuerdo_con_dudo_de_mi_mismo = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Si enfrento dificultades en la vida, frecuentemente dudo de mí mismo"))
    acuerdo_con_oportunidades_dadas_por_condiciones_sociales = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Las oportunidades que tengo en la vida están determinadas por las condiciones sociales"))
    acuerdo_con_habilidades_mas_que_esfuerzo = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Las habilidades con las que nací son más importantes que todo el esfuerzo que yo pueda hacer"))
    acuerdo_con_poco_control_de_la_vida = models.PositiveIntegerField(
        choices=RANGO_1_10, default=RANGO_1_10[0], widget=widgets.RadioSelectHorizontal(),
        verbose_name=("Tengo poco control sobre las cosas que suceden en mi vida"))

    TOTALMENTE_MUCHO_REGULAR_POCO_NADA = ("---", "Totalmente", "Mucho", "Regular", "Poco", "Nada")
    que_tanto_es_es_reservado = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Es reservado(a)"))
    que_tanto_es_confiable = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Es generalmente confiable"))
    que_tanto_es_flojo = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Tiende a ser flojo(a)"))
    que_tanto_es_relajado = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Es relajado(a) o maneja bien el estrés"))
    que_tanto_es_artista = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Tiene intereses artísticos"))
    que_tanto_es_sociable = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Es extrovertido(a) o sociable"))
    que_tanto_es_falla_en_los_demas = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Tiende a encontrar fallas en los demás"))
    que_tanto_es_nervioso = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Se pone nervioso(a) fácilmente"))
    que_tanto_es_imaginador = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Tiene una imaginación activa"))

    que_tanto_lo_describe_ideas_me_distraen = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Algunas veces nuevas ideas y proyectos me distraen de mis proyectos e ideas anteriores"))
    que_tanto_lo_describe_contratiempos_desanima = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Los contratiempos no me desaniman"))
    que_tanto_lo_describe_persona_trabajadora = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Soy una persona muy trabajadora"))
    que_tanto_lo_describe_pierdo_interes = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Me obsesiono con ideas o proyectos por un tiempo, pero pierdo el interés rápidamente."))
    que_tanto_lo_describe_persigo_diferentes_metas = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Frecuentemente me pongo una meta pero más tarde persigo una diferente."))
    que_tanto_lo_describe_dificultades_para_concentracion = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Tengo dificultades para mantener mi concentración en proyectos que toman más de unos cuantos meses en completarse."))
    que_tanto_lo_describe_termino_lo_que_comienzo = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Termino todo lo que comienzo"))
    que_tanto_lo_describe_efuerzo_en_mi_trabajo = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Pongo mucho esfuerzo en los trabajos que realizo"))
    que_tanto_lo_describe_malos_habitos = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Me cuesta romper malos hábitos"))
    que_tanto_lo_describe_cosas_inapropiadas = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Frecuentemente digo cosas inapropiadas"))
    que_tanto_lo_describe_resisto_tentaciones = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Soy muy bueno para resistir tentaciones"))
    que_tanto_lo_describe_me_arrepiento = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Hago cosas que se sienten bien en el momento pero después me arrepiento de ellas"))
    que_tanto_lo_describe_hago_cosas_sin_pensar = models.CharField(
        choices=TOTALMENTE_MUCHO_REGULAR_POCO_NADA, default=TOTALMENTE_MUCHO_REGULAR_POCO_NADA[0],
        max_length=30, verbose_name=("Frecuentemente hago cosas sin pensar en todas las opciones"))

    apuesta_loteria_1000 = models.PositiveIntegerField(
        verbose_name=("Imagine un juego de lotería con diez boletos numerados del 1 al 10, cuyo premio al número ganador es de $1,000. ¿Cuánto estaría dispuesto a pagar por un boleto para participar en ella?"),
        min=0, max=1000, widget=widgets.SliderInput(), default=0)

    donar_1000 = models.PositiveIntegerField(
        verbose_name=("Imagine la siguiente situación: El día de hoy usted recibe inesperadamente $1,000. ¿Cuánto consideraría donar a una buena causa?"),
        min=0, max=1000, widget=widgets.SliderInput(), default=0)

    pagan_100_esperar_3_meses = models.PositiveIntegerField(
        min=1000, max=50000,  widget=widgets.SliderInput(),
        verbose_name=("¿Cuánto le tendrían que pagar dentro de tres meses para que pueda esperar este tiempo?"), default=0)
    que_tanto_lo_describe_1_anio = models.PositiveIntegerField(
        min=1000, max=50000,  widget=widgets.SliderInput(),
        verbose_name=("Y ahora, ¿cuánto le tendrían que pagar dentro de un año para que pueda esperar ese tiempo?"), default=0)

    # bloque 4
    block_4_last_question_clicked = models.IntegerField(default=0, widget=widgets.HiddenInput())

    # MUJERES
    mestruando = models.BooleanField(
        verbose_name="¿Se encuentra usted menstruando el día de hoy?", default=False, widget=widgets.RadioSelectHorizontal())

    fecha_ultima_regla = models.DateField(
        default=lambda: timezone.now().date(),
        verbose_name="Fecha de comienzo de última regla (si no recuerda con precisión, favor de indicar la fecha más próxima).")
    fecha_siguiente_regla = models.DateField(
        default=lambda: timezone.now().date(),
        verbose_name="Fecha esperada de comienzo de siguiente regla (si no puede calcular con precisión, favor de indicar la fecha más próxima independientemente de si usted es regular o irregular)")

    anticonceptivos = models.BooleanField(
        verbose_name="¿Utiliza pastillas anticonceptivas?", default=False, widget=widgets.RadioSelectHorizontal())

    duracion_del_sangrado = models.PositiveIntegerField(
        verbose_name=("¿Normalmente, cuántos días dura el sangrado?"),
        widget=widgets.SliderInput(), default=5, min=1, max=10)

    # HOMBRES
    trabaja_empresa_dependencia_publica = models.BooleanField(
        verbose_name="Actualmente se encuentra trabajando en alguna empresa o dependencia pública?",
        default=False, widget=widgets.RadioSelectHorizontal())

    fecha_busqueda_empleo = models.DateField(
        default=lambda: timezone.now().date(),
        verbose_name="Aproximadamente, cuando fue la última fecha en que buscó empleo?.")
    fecha_fin_de_estudios  = models.DateField(
        default=lambda: timezone.now().date(),
        verbose_name="Fecha en la que dio por terminados sus estudios?")

    discriminacion_laboral = models.BooleanField(
        verbose_name="Desde su perspectiva, alguna vez ha sido victima de discriminación laboral?",
        default=False, widget=widgets.RadioSelectHorizontal())

    que_tanto_presencio_discriminacion = models.PositiveIntegerField(
        verbose_name=("En una escala del 1 al 10, que tanto ha presenciado discriminación, para usted o algún compañero, en el campo laboral?"),
        widget=widgets.SliderInput(), default=5, min=1, max=10)


    # Bloque 5
    FIGURE_CHOICES_6 = ['---', '1', '2', '3', '4', '5', '6']

    fig1 = models.CharField(
        verbose_name="fig1.jpg",
        max_length=10, choices=FIGURE_CHOICES_6, default=FIGURE_CHOICES_6[0])
    fig2 = models.CharField(
        verbose_name="fig2.jpg",
        max_length=10, choices=FIGURE_CHOICES_6, default=FIGURE_CHOICES_6[0])
    fig3 = models.CharField(
        verbose_name="fig3.jpg",
        max_length=10, choices=FIGURE_CHOICES_6, default=FIGURE_CHOICES_6[0])
    fig4 = models.CharField(
        verbose_name="fig4.jpg",
        max_length=10, choices=FIGURE_CHOICES_6, default=FIGURE_CHOICES_6[0])

    FIGURE_CHOICES_8 = ['---', '1', '2', '3', '4', '5', '6', '7', '8']
    fig5 = models.CharField(
        verbose_name="fig5.jpg",
        max_length=10, choices=FIGURE_CHOICES_8, default=FIGURE_CHOICES_8[0])
    fig6 = models.CharField(
        verbose_name="fig6.jpg",
        max_length=10, choices=FIGURE_CHOICES_8, default=FIGURE_CHOICES_8[0])
    fig7 = models.CharField(
        verbose_name="fig7.jpg",
        max_length=10, choices=FIGURE_CHOICES_8, default=FIGURE_CHOICES_8[0])
    fig8 = models.CharField(
        verbose_name="fig8.jpg",
        max_length=10, choices=FIGURE_CHOICES_8, default=FIGURE_CHOICES_8[0])
    fig9 = models.CharField(
        verbose_name="fig9.jpg",
        max_length=10, choices=FIGURE_CHOICES_8, default=FIGURE_CHOICES_8[0])
    fig10 = models.CharField(
        verbose_name="fig10.jpg",
        max_length=10, choices=FIGURE_CHOICES_8, default=FIGURE_CHOICES_8[0])
Example #12
0
class Player(BasePlayer):

    q1_first_game_judge_surprised = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q1_first_game_judge_satisfied = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q1_first_game_judge_upset = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))

    q1_players_helping_each_other = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q1_team_spirit_or_cohesion = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q1_important_presented_image_of_and_to_yourself = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q1_important_maximum_and_fair_resources_to_everyone = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q1_important_other_members_trust_in_you = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q1_important_not_you_maximum_and_fair_resources_to_everyone = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q1_trust_do_you_have_into_other_members = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q1_how_much_do_you_like_the_other_team_members = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q1_how_good_do_you_understand_solving = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q1_how_good_do_the_other_group_members_understand_solving = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))

    q1_how_to_improve_the_groups_behavior_to_maximize_resources = models.TextField(
    )
    q1_which_strategy_would_you_follow_and_why = models.TextField()
    q1_if_communicate_what_would_you_say_and_why = models.TextField()
Example #13
0
class Player(BasePlayer):
    q3_second_game_results_surprised = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_second_game_results_satisfied = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_second_game_results_upset = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))

    q3_second_game_teamwork = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_second_game_teamspirit = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_communication_inputs_maxresources_how_useful = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_followed_communication_inputs = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_took_advantage_communication_inputs = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_majority_followed_communication_inputs = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_majority_took_advantage_communication_inputs = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_minority_followed_communication_inputs = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_minority_took_advantage_communication_inputs = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_how_max_resources_communication_inputs_if_followed = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_after_second_round_like_others = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_second_round_impressions = models.TextField()
    q3_best_strategy_to_max_resources = models.TextField()
    q3_gender = models.CharField(choices=["M", "F"],
                                 widget=widgets.RadioSelectHorizontal())
    q3_birthday = models.DateField(widget=widgets.Input())
    q3_main_subject_in_university = models.TextField()
    q3_already_take_part_in_a_problem_solving = models.CharField(
        max_length=255, widget=widgets.RadioSelect(), choices=['Ja', 'Nein'])
    q3_already_took_part_x_times_for_x_months = models.TextField(
        default='X Male und das letzte Mal vor X Monaten.')
    q3_experiment_itself_was_interessting = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_were_you_personally_engaged_achieving_good_results = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_dificult_understanding_and_solving_the_problem = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_was_it_obvious_what_to_do = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_count_unclear_questions = models.TextField()
    q3_unclear_questions_description = models.TextField()
    q3_technical_issues = models.CharField(max_length=255,
                                           widget=widgets.RadioSelect(),
                                           choices=['Ja', 'Nein'])
    q3_technical_issues_details = models.TextField()
    q3_opinion_about_questions_and_hypotheses = models.TextField()

    # confidant

    q3_confidant_second_game_teamwork = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_confidant_second_game_teamspirit = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_confidant_majority_followed_communication_inputs = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_confidant_majority_took_advantage_communication_inputs = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_confidant_minority_followed_communication_inputs = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_confidant_minority_took_advantage_communication_inputs = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_confidant_best_strategy_to_max_resources = models.TextField()
    q3_confidant_gender = models.CharField(
        choices=["M", "F"], widget=widgets.RadioSelectHorizontal())
    q3_confidant_birthday = models.DateField(widget=widgets.Input())
    q3_confidant_main_subject_in_university = models.TextField()
    q3_confidant_already_take_part_in_a_problem_solving = models.CharField(
        max_length=255, widget=widgets.RadioSelect(), choices=['Ja', 'Nein'])
    q3_confidant_already_took_part_x_times_for_x_months = models.TextField(
        default='X Male und das letzte Mal vor X Monaten.')
    q3_confidant_experiment_itself_was_interessting = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_confidant_were_you_personally_engaged_achieving_good_results = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_confidant_dificult_understanding_and_solving_the_problem = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_confidant_was_it_obvious_what_to_do = models.PositiveIntegerField(
        min=1, max=10, widget=widgets.SliderInput(show_value=False))
    q3_confidant_count_unclear_questions = models.TextField()
    q3_confidant_unclear_questions_description = models.TextField()
    q3_confidant_technical_issues = models.CharField(
        max_length=255, widget=widgets.RadioSelect(), choices=['Ja', 'Nein'])
    q3_confidant_technical_issues_details = models.TextField()
Example #14
0
class Player(otree.models.BasePlayer):

    # <built-in>
    group = models.ForeignKey(Group, null=True)
    subsession = models.ForeignKey(Subsession)
    # </built-in>

    fw = models.CurrencyField(min=0)
    bet = models.PositiveIntegerField(min=0,
                                      max=100,
                                      widget=widgets.SliderInput())
    rt = models.FloatField()
    is_winner = models.BooleanField()

    def feedback_time(self):
        round_number = self.subsession.round_number
        if self.group.subgroup_type in (Constants.sg1, Constants.sg3):
            return True
        return round_number % 3 == 0

    def decide_time(self):
        if self.group.subgroup_type in (Constants.sg3, Constants.sg2):
            return self.subsession.round_number in (1, 4, 7)
        return True

    def gadd_payoff(self, winner, pw):
        X = Constants.gadd_endowment
        alpha_t = self.bet / 100.
        rtp = (Constants.win_perc if winner else Constants.loose_perc) / 100.
        self.payoff = float(X * (alpha_t * rtp))
        increment = X * (alpha_t * (1 + rtp) + (1 - alpha_t))
        self.fw = pw + increment

    def gmul_payoff(self, winner, pw):
        alpha_t = self.bet / 100.
        rtp = (Constants.win_perc if winner else Constants.loose_perc) / 100.
        self.payoff = float(pw * alpha_t * rtp)
        self.fw = pw * (alpha_t * (1 + rtp) + (1 - alpha_t))

    def set_payoff(self):

        # retrieve the last whealt
        fw = self.last_fw()

        # check if is winner
        self.is_winner = (random.randint(0, 99) <= Constants.win_chance)

        # payoff ccompute
        if self.group.group_type == Constants.gadd:
            self.gadd_payoff(self.is_winner, fw)
        else:
            self.gmul_payoff(self.is_winner, fw)

    def last_fw(self):
        previous = self.in_previous_rounds()
        first = not previous
        if first and self.group.group_type == Constants.gadd:
            return 0
        elif first and self.group.group_type == Constants.gmul:
            return Constants.gmul_endowment
        return previous[-1].fw

    def current_wealth(self):
        if self.group.subgroup_type == Constants.sg1:
            cw = self.last_fw()
        else:
            round_idx = self.subsession.round_number - 1
            if round_idx in (0, 3, 6):
                cw = self.last_fw()
            elif round_idx in (1, 2):
                players = self.in_previous_rounds()
                cw = players[0].last_fw()
            elif round_idx in (4, 5):
                players = self.in_previous_rounds()
                cw = players[3].last_fw()
            elif round_idx in (7, 8):
                players = self.in_previous_rounds()
                cw = players[6].last_fw()

        if self.group.group_type == Constants.gadd:
            cw += Constants.gadd_endowment
        return cw

    def previous_bet(self):
        if self.subsession.round_number == 1:
            return None
        return self.in_previous_rounds()[-1].bet
Example #15
0
class Player(otree.models.BasePlayer):

    # <built-in>
    group = models.ForeignKey(Group, null=True)
    subsession = models.ForeignKey(Subsession)
    # </built-in>

    name = models.CharField(max_length=255, verbose_name="Your name")

    age = models.CharField(max_length=255, verbose_name="Your age")

    email = models.EmailField(verbose_name="Your email address")

    gender = models.CharField(verbose_name="Are you",
                              max_length=255,
                              widget=widgets.RadioSelect(),
                              choices=["Male", "Female"])

    major = models.CharField(max_length=1000,
                             verbose_name="What is your major?")

    working_in_a_location_of_their_choice_more_less_to_the_team = models.CharField(
        verbose_name=
        "When you were in a group with two TELECOMMUTERS working in a "
        "location and time of their choice, did you want to give more "
        "to the group account than when you were partnered "
        "with two LAB PARTICIPANTS?",
        max_length=500,
        widget=widgets.RadioSelect(),
        choices=[
            "More to the Group Account with TELECOMMUTERS",
            "Less to the Group Account with TELECOMMUTERS", "Didn't Matter"
        ])

    partners_in_location_their_choice_worked_harder_than_the_lab = models.CharField(
        verbose_name=
        "Do you believe your TELECOMMUTER group members gave more/less/the same to the group "
        "account than your LAB PARTICIPANT group members?",
        max_length=500,
        widget=widgets.RadioSelect(),
        choices=[
            "TELECOMMUTERS gave more", "TELECOMMUTERS gave less",
            "Both types gave the same"
        ])

    location_of_your_partners_influence_your_decisions = models.TextField(
        verbose_name=(
            "Did your group members' type (TELECOMMUTERS or LAB PARTICIPANTS) "
            "influence your decisions today in a way not accounted for above? "
            "If so, please explain."))

    I_work_best_in = models.CharField(
        verbose_name="Which do you prefer working in?",
        max_length=255,
        widget=widgets.RadioSelect(),
        choices=["Structured environments", "flexible environments"])

    I_work_prefer = models.CharField(
        verbose_name="Which type of work do you prefer?",
        max_length=255,
        widget=widgets.RadioSelect(),
        choices=["Working Alone", "Working in Groups"])

    risks_in_everyday_life = models.PositiveIntegerField(
        min=1,
        max=10,
        widget=widgets.SliderInput(),
        verbose_name=("In general, do you take more or less risks in everyday "
                      "life? ('1' = take less risk and '10' take more risk.)"))

    risks_in_financial_decision = models.PositiveIntegerField(
        min=1,
        max=10,
        widget=widgets.SliderInput(),
        default=5,
        verbose_name=
        (" In general, do you take more or less risks in financial decisions? "
         "life? ('1' = take less risk and '10' take more risk.)"))
Example #16
0
class Player(BasePlayer):

    q3_second_game_surprised = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q3_second_game_satisfied = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q3_second_game_upset = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))

    q3_help_each_other_in_the_second_game = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q3_team_spirit = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q3_recommendations_of_actions_to_maximize_everyones_resources = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))

    q3_i_follow_recommendations_of_action_followed = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q3_i_follow_recommendations_of_action_my_advantage = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))

    q3_others_follow_recommendations_of_action_followed = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q3_others_follow_recommendations_of_action_their_advantage = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))

    q3_yopinion_if_they_followed_would_everyone_max_his_resources = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))

    q3_second_game_different_and_is_it_because_of_the_communication = models.TextField(
    )
    q3_the_best_strategy_to_optimize_everyones_resources = models.TextField()

    q3_gender = models.CharField(choices=["Male", "Female"],
                                 widget=widgets.RadioSelectHorizontal())
    q3_birthday = models.DateField(widget=widgets.Input())

    q3_main_subject_in_university = models.TextField()
    q3_already_take_part_in_a_problem_solving = models.BooleanField(
        widget=widgets.RadioSelectHorizontal())

    q3_experiment_itself_was_interessting = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q3_were_you_personally_engaged_achieving_good_results = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q3_dificult_understanding_and_solving_the_problem = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q3_was_it_obvious_what_to_do = models.PositiveIntegerField(
        min=1, max=5, widget=widgets.SliderInput(show_value=False))
    q3_short_feedback = models.TextField()
Example #17
0
class Player(BasePlayer):

	vcm_round = models.PositiveIntegerField(
		doc='The vcm round number.'
		)

	individual_exchange = models.FloatField(
		initial=None,
		verbose_name='Individual exchange:',
		doc="Individual exchange contribution in this round")

	group_exchange = models.FloatField(
		initial=None,
		verbose_name='Group exchange:',
		doc="Group exchange contribution in this round")

	group_exchange_percent = models.FloatField(
		min = 1, max = 100,
		blank=True, #not required
		doc="in this round, this subject's percent contribution to group exchange relative to total amount availale to user",
		widget=widgets.SliderInput(
			attrs={'step': '1','value':'5'}))


	total_op_individual_exchange = models.FloatField(
		doc='total individual_exchange contributions of opposing players'
		)

	total_op_group_exchange = models.FloatField(
		doc='total group_exchange contributions of opposing players'
		)

	mpcr = models.FloatField(
		doc="marginal per-capita rate of return to vcm game")
	
	round_points = models.FloatField(
		doc='Points earned this round from the VCM'
		)

	player_role = models.CharField(
		doc="player type, A or F"
		)

	player_role_list = models.CharField(
		doc="list of all player roles after assignment. index 0 -> P1, index 1 -> P2"
		)

	paid_round = models.PositiveIntegerField(
		doc='vmc period that is paid on')

	final_score = models.FloatField(
		doc="this palyer's final score in this round")

	final_avg_ge = models.FloatField(
		doc="this player's final average group exchange contribution over all rounds")




	def set_payoffs(self):
		"""calc player payoffs"""
		self.total_op_individual_exchange = sum([p.individual_exchange for p in self.get_others_in_group()])
		self.total_op_group_exchange = sum([p.group_exchange for p in self.get_others_in_group()])

		self.round_points = self.individual_exchange + (0 * self.total_op_individual_exchange) + (self.mpcr * self.total_op_group_exchange) + (self.mpcr * self.group_exchange)





	def set_roles(self, overall_ge_percent_list):
		"""set player roles"""

		own_id_index = self.participant.vars['id_in_subsession'] - 1

		# rank players (globally) by group exchange contribution
		self.participant.vars['GE_Rank_list'] = ((rankdata(np.array(overall_ge_percent_list), method='ordinal'))).tolist()
		self.participant.vars['GE_Rank'] = ((rankdata(np.array(overall_ge_percent_list), method='ordinal'))).tolist()[own_id_index]

		# type cutoff rank
		cufoff_F = max(p.participant.vars['id_in_subsession'] for p in self.subsession.get_players() if p.group_exchange_percent != None) / 2

		# details...
		if (self.participant.vars['GE_Rank'] > cufoff_F):
		    self.player_role = self.participant.vars['Role'] = "A"
		else:
		    self.player_role = self.participant.vars['Role'] = "A" #SH was F

		# set player_role_list, a log of each player's role
		player_role_list = []
		for id_ in range(0,len(overall_ge_percent_list)):
			if (rankdata(np.array(overall_ge_percent_list), method='ordinal').tolist()[id_] > cufoff_F):
			    player_role_list.append("A")
			else:
			    player_role_list.append("A") #SH was F

		self.player_role_list = self.participant.vars['player_role_list'] = player_role_list #just for debugging, might delete  self.participant.vars['player_role_list'] later.

		#this is the key var passed to stage game.
		self.participant.vars['player_role_list'] = player_role_list #used to get roles in stage game.
		self.participant.vars['overall_ge_percent_list'] = overall_ge_percent_list
		self.final_avg_ge = self.participant.vars['overall_ge_percent'] = overall_ge_percent_list[own_id_index]
		self.participant.vars['overall_own_ge'] = overall_ge_percent_list[own_id_index] * self.participant.vars["ret_score"]