from typing import List from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Introduction(Page): timeout_seconds = 60 class Questionaire(Page): form_model = 'player' form_fields = ['age', 'gender', 'nationality', 'residency', 'education', ] class ValueSurvey(Page): form_model = 'player' form_fields = ['Equality', 'Inner_Harmony', 'Social_Power', 'Pleasure', 'Freedom', 'Spritual_Life', 'Sense_of_Belonging', 'Social_Order', 'Exciting_Life', 'Meaning_in_Life', 'Politeness', 'Wealth', 'National_Security', 'Self_Respect', 'Reciprocation_of_Favors', 'Creativity', 'World_Peace', 'Respect_Tradition', 'Mature_Love', 'Self_Discipline', 'Privacy', 'Family_Security', 'Social_Recognition', 'Unity_with_Nature', 'Varied_Life', 'Wisdom', 'Authority', 'True_Friendship', 'World_of_Beauty', 'Social_justice', 'Independent', 'Moderate', 'Loyal', 'Ambitious', 'Broad_minded', 'Humble', 'Daring', 'Protect_Environment', 'Influential', 'Honoring_parents_Elders', 'Choosing_Own_Goal', 'Healthy', 'Capable', 'Accepting_Portion', 'Honest', 'Preserve_Public_Image', 'Obedient', 'Inteligent', 'Helpful', 'Enjoy_Life', 'Devout', 'Responsible', 'Curious', 'Forgiving', 'Successful', 'Clean', 'Self_Indulgent', 'Observing_Social_Norms', 'Present_value', 'Punish_for_self', 'Punish_for_others', 'Good_cause', ] class ResultsWaitPage(WaitPage): def after_all_players_arrive(self): group = self.group players = self.group.get_players() for p in self.group.get_players(): p.set_conformity() p.set_tradition() p.set_benevolence() p.set_universalism() p.set_self_direction() p.set_stimulation() p.set_hedonism() p.set_achievement() p.set_power() p.set_security() p.set_score() '''class Results(Page): def vars_for_template(self): return { 'my_Equality': self.player.Equality, 'my_Inner_Harmony': self.player.Inner_Harmony, 'my_Social_Power': self.player.Social_Power, 'my_Pleasure': self.player.Pleasure, 'my_Freedom': self.player.Freedom, 'my_Spritual_Life': self.player.Spritual_Life, 'my_Sense_of_Belonging': self.player.Sense_of_Belonging, 'my_Social_Order': self.player.Social_Order, 'my_Exciting_Life': self.player.Exciting_Life, 'my_Meaning_in_Life': self.player.Meaning_in_Life, 'my_Politeness': self.player.Politeness, 'my_Wealth': self.player.Wealth, 'my_National_Security': self.player.National_Security, 'my_Self_Respect': self.player.Self_Respect, 'my_Reciprocation_of_Favors': self.player.Reciprocation_of_Favors, 'my_Creativity': self.player.Creativity, 'my_World_Peace': self.player.World_Peace, 'my_Respect_Tradition': self.player.Respect_Tradition, 'my_Mature_Love': self.player.Mature_Love, 'my_Self_Discipline': self.player.Self_Discipline, 'my_Privacy': self.player.Privacy, 'my_Family_Security': self.player.Family_Security, 'my_Social_Recognition': self.player.Social_Recognition, 'my_Unity_with_Nature': self.player.Unity_with_Nature, 'my_Varied_Life': self.player.Varied_Life, 'my_Wisdom': self.player.Wisdom, 'my_Authority': self.player.Authority, 'my_True_Friendship': self.player.True_Friendship, 'my_World_of_Beauty': self.player.World_of_Beauty, 'my_Social_justice': self.player.Social_justice, 'my_Independent': self.player.Independent, 'my_Moderate': self.player.Moderate, 'my_Loyal': self.player.Loyal, 'my_Ambitious': self.player.Ambitious, 'my_Broad_minded': self.player.Broad_minded, 'my_Humble': self.player.Humble, 'my_Daring': self.player.Daring, 'my_Protect_Environment': self.player.Protect_Environment, 'my_Influential': self.player.Influential, 'my_Honoring_parents_Elders': self.player.Honoring_parents_Elders, 'my_Choosing_Own_Goal': self.player.Choosing_Own_Goal, 'my_Healthy': self.player.Healthy, 'my_Capable': self.player.Capable, 'my_Accepting_Portion': self.player.Accepting_Portion, 'my_Honest': self.player.Honest, 'my_Preserve_Public_Image': self.player.Preserve_Public_Image, 'my_Obedient': self.player.Obedient, 'my_Inteligent': self.player.Inteligent, 'my_Helpful': self.player.Helpful, 'my_Enjoy_Life': self.player.Enjoy_Life, 'my_Devout': self.player.Devout, 'my_Responsible': self.player.Responsible, 'my_Curious': self.player.Curious, 'my_Forgiving': self.player.Forgiving, 'my_Successful': self.player.Successful, 'my_Clean': self.player.Clean, 'my_Self_Indulgent': self.player.Self_Indulgent, 'my_Observing_Social_Norms': self.player.Observing_Social_Norms, 'my_Present_value': self.player.Present_value, 'my_Punish_for_self': self.player.Punish_for_self, 'my_Punish_for_others': self.player.Punish_for_others, 'my_Good_cause' : self.player.Good_cause, 'other_Equality': self.player.other_player().Equality, 'other_Inner_Harmony': self.player.other_player().Inner_Harmony, 'other_Social_Power': self.player.other_player().Social_Power, 'other_Pleasure': self.player.other_player().Pleasure, 'other_Freedom': self.player.other_player().Freedom, 'other_Spritual_Life': self.player.other_player().Spritual_Life, 'other_Sense_of_Belonging': self.player.other_player().Sense_of_Belonging, 'other_Social_Order': self.player.other_player().Social_Order, 'other_Exciting_Life': self.player.other_player().Exciting_Life, 'other_Meaning_in_Life': self.player.other_player().Meaning_in_Life, 'other_Politeness': self.player.other_player().Politeness, 'other_Wealth': self.player.other_player().Wealth, 'other_National_Security': self.player.other_player().National_Security, 'other_Self_Respect': self.player.other_player().Self_Respect, 'other_Reciprocation_of_Favors': self.player.other_player().Reciprocation_of_Favors, 'other_Creativity': self.player.other_player().Creativity, 'other_World_Peace': self.player.other_player().World_Peace, 'other_Respect_Tradition': self.player.other_player().Respect_Tradition, 'other_Mature_Love': self.player.other_player().Mature_Love, 'other_Self_Discipline': self.player.other_player().Self_Discipline, 'other_Privacy': self.player.other_player().Privacy, 'other_Family_Security': self.player.other_player().Family_Security, 'other_Social_Recognition': self.player.other_player().Social_Recognition, 'other_Unity_with_Nature': self.player.other_player().Unity_with_Nature, 'other_Varied_Life': self.player.other_player().Varied_Life, 'other_Wisdom': self.player.other_player().Wisdom, 'other_Authority': self.player.other_player().Authority, 'other_True_Friendship': self.player.other_player().True_Friendship, 'other_World_of_Beauty': self.player.other_player().World_of_Beauty, 'other_Social_justice': self.player.other_player().Social_justice, 'other_Independent': self.player.other_player().Independent, 'other_Moderate': self.player.other_player().Moderate, 'other_Loyal': self.player.other_player().Loyal, 'other_Ambitious': self.player.other_player().Ambitious, 'other_Broad_minded': self.player.other_player().Broad_minded, 'other_Humble': self.player.other_player().Humble, 'other_Daring': self.player.other_player().Daring, 'other_Protect_Environment': self.player.other_player().Protect_Environment, 'other_Influential': self.player.other_player().Influential, 'other_Honoring_parents_Elders': self.player.other_player().Honoring_parents_Elders, 'other_Choosing_Own_Goal': self.player.other_player().Choosing_Own_Goal, 'other_Healthy': self.player.other_player().Healthy, 'other_Capable': self.player.other_player().Capable, 'other_Accepting_Portion': self.player.other_player().Accepting_Portion, 'other_Honest': self.player.other_player().Honest, 'other_Preserve_Public_Image': self.player.other_player().Preserve_Public_Image, 'other_Obedient': self.player.other_player().Obedient, 'other_Inteligent': self.player.other_player().Inteligent, 'other_Helpful': self.player.other_player().Helpful, 'other_Enjoy_Life': self.player.other_player().Enjoy_Life, 'other_Devout': self.player.other_player().Devout, 'other_Responsible': self.player.other_player().Responsible, 'other_Curious': self.player.other_player().Curious, 'other_Forgiving': self.player.other_player().Forgiving, 'other_Successful': self.player.other_player().Successful, 'other_Clean': self.player.other_player().Clean, 'other_Self_Indulgent': self.player.other_player().Self_Indulgent, 'other_Observing_Social_Norms': self.player.other_player().Observing_Social_Norms, 'other_Present_value': self.player.other_player().Present_value, 'other_Punish_for_self': self.player.other_player().Punish_for_self, 'other_Punish_for_others': self.player.other_player().Punish_for_others, 'other_Good_cause': self.player.other_player().Good_cause, } ''' class End(Page): def is_displayed(self): return (self.round_number == Constants.num_rounds) ''' def vars_for_template(self): group = self.group players = self.group.get_players() my_conformity = [p.conformity for p in players] other_conformity = [p.other_player().conformity for p in players] my_tradition = [p.tradition for p in players] my_benevolence = [p.benevolence for p in players] my_universalism = [p.universalism for p in players] my_self_direction = [p.self_direction for p in players] my_stimulation = [p.stimulation for p in players] my_hedonism = [p.hedonism for p in players] my_achievement = [p.achievement for p in players] my_power = [p.power for p in players] my_security = [p.security for p in players] return { 'my_conformity': my_conformity, 'other_conformity': other_conformity, 'my_tradition': my_tradition, 'my_benevolence': my_benevolence, 'my_universalism': my_universalism, 'my_self_direction': my_self_direction, 'my_stimulation': my_stimulation, 'my_hedonism': my_hedonism, 'my_achievement': my_achievement, 'my_power': my_power, 'my_security': my_security } def after_all_players_arrive(self): embeddedness = ((sum(self.player.Social_Order) + sum(self.player.Politeness) + sum( self.player.National_Security) + sum(self.player.Reciprocation_of_Favors) + sum( self.player.Respect_Tradition) + sum(self.player.Self_Discipline) + sum(self.player.Wisdom) + sum( self.player.Moderate) + sum(self.player.Honoring_parents_Elders) + sum( self.player.Preserve_Public_Image) + sum(self.player.Obedient) + sum(self.player.Devout) + sum( self.player.Forgiving) + sum(self.player.Clean)) / 14) ''' page_sequence = [ Introduction, Questionaire, ValueSurvey, ResultsWaitPage, # Results, End, ]