from otree.api import * import time import random import math from decimal import Decimal import psycopg2 import sqlite3 import math class C(BaseConstants): NAME_IN_URL = 'grpc_p2' PLAYERS_PER_GROUP = 4 NUM_ROUNDS = 1 class Group(BaseGroup): pass class Subsession(BaseSubsession): pass class Player(BasePlayer): active_flag = models.IntegerField(initial=0) mgr_ready = models.IntegerField(initial=0) worker_id = models.CharField(initial='e') mturk_dupe = models.IntegerField(initial=0) participant_number = models.IntegerField(default=0) total_compensation = models.StringField(default='Not Finished') condition = models.IntegerField() condition_label = models.StringField(default='NA') kc4 = models.StringField(initial=None, choices=['True', 'False'], verbose_name='', widget=widgets.RadioSelect()) kc5 = models.StringField(initial=None, choices=['True', 'False'], verbose_name='', widget=widgets.RadioSelect()) kc6 = models.StringField(initial=None, choices=['True', 'False'], verbose_name='', widget=widgets.RadioSelect()) kc7 = models.StringField(initial=None, choices=['True', 'False'], verbose_name='', widget=widgets.RadioSelect()) manager_id = models.IntegerField() s1_contribution = models.FloatField(verbose_name='') s1_decision_time = models.StringField() s1_pay = models.FloatField() s1_coworker_1_contribution = models.FloatField() s1_coworker_2_contribution = models.FloatField() s1_team_contribution = models.FloatField() s2_control = models.IntegerField(default=0) s2_contribution = models.FloatField(default=-1.00) # Setting default of -1.00 for manager check s2_decision_time = models.StringField() s2_pay = models.FloatField() s2_coworker_1_contribution = models.FloatField() s2_coworker_2_contribution = models.FloatField() s2_team_contribution = models.FloatField() total_pay = models.FloatField() #PEQ downward_trust = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) downward_trust_coworkers = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) upward_trust = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) horizontal_trust = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) manager_affinity = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) coworkers_high_contributions = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) team_identification = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) coworker_affinity = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) manager_priority = models.StringField(initial=None, choices=[('a', 'My well-being'), ('b', 'Their own interests'), ('c', 'Both equally')], verbose_name='', widget=widgets.RadioSelect()) manager_priority_magnitude = models.StringField(initial=None, choices=[('1', '1 = Slightly more'), ('2', '2 '), ('3', '3 = Moderately more'), ('4', '4 '), ('5', '5 = Significantly more')], verbose_name='', widget=widgets.RadioSelect()) manager_control = models.StringField(initial=None, choices=[('1', '1 = No control'), ('2', '2 = A little control'), ('3', '3 = A moderate amount of control'), ('4', '4 = A lot of control'), ('5', '5 = Complete control')], verbose_name='', widget=widgets.RadioSelectHorizontal()) control_attribution = models.StringField(initial=None, choices=[('a', 'Manager B'), ('b', 'Other Workers'), ('c', 'Both equally')], verbose_name='', widget=widgets.RadioSelect()) attribution_magnitude = models.StringField(initial=None, choices=[('1', '1 = Slightly more'), ('2', '2 '), ('3', '3 = Moderately more'), ('4', '4 '), ('5', '5 = Significantly more')], verbose_name='', widget=widgets.RadioSelect()) s2_autonomy = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) s2_mgr_intrusion = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) s2_mgr_fairness = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) s2_control_fairness = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) s2_coworker_equity = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) s2_manager_bonus = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) s2_right_thing = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) s2_coworker_competition = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) s2_mgr_expectations = models.FloatField(verbose_name='') s2_coworker_info_effect = models.StringField(initial=None, choices=[('1', '1 = It made me want to contribute much less.'), ('2', '2 '), ('3', '3 '), ('4', '4 = It had no effect on my decision.'), ('5', '5 '), ('6', '6 '), ('7', '7 = It made me want to contribute much more.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) control_reaction = models.StringField(verbose_name='') manager_motivation = models.StringField(verbose_name='') helping_energizes = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) helping_importance = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) helping_preference = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) best_while_helping = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) like_helping = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) affect_enthusiastic = models.StringField(initial=None, choices=[('1', '1 = Not at all'), ('2', '2 = A little'), ('3', '3 = Moderately'), ('4', '4 = Quite a bit'), ('5', '5 = Extremely')], verbose_name='', widget=widgets.RadioSelectHorizontal()) affect_upset = models.StringField(initial=None, choices=[('1', '1 = Not at all'), ('2', '2 = A little'), ('3', '3 = Moderately'), ('4', '4 = Quite a bit'), ('5', '5 = Extremely')], verbose_name='', widget=widgets.RadioSelectHorizontal()) affect_interested = models.StringField(initial=None, choices=[('1', '1 = Not at all'), ('2', '2 = A little'), ('3', '3 = Moderately'), ('4', '4 = Quite a bit'), ('5', '5 = Extremely')], verbose_name='', widget=widgets.RadioSelectHorizontal()) affect_distressed = models.StringField(initial=None, choices=[('1', '1 = Not at all'), ('2', '2 = A little'), ('3', '3 = Moderately'), ('4', '4 = Quite a bit'), ('5', '5 = Extremely')], verbose_name='', widget=widgets.RadioSelectHorizontal()) affect_determined = models.StringField(initial=None, choices=[('1', '1 = Not at all'), ('2', '2 = A little'), ('3', '3 = Moderately'), ('4', '4 = Quite a bit'), ('5', '5 = Extremely')], verbose_name='', widget=widgets.RadioSelectHorizontal()) affect_nervous = models.StringField(initial=None, choices=[('1', '1 = Not at all'), ('2', '2 = A little'), ('3', '3 = Moderately'), ('4', '4 = Quite a bit'), ('5', '5 = Extremely')], verbose_name='', widget=widgets.RadioSelectHorizontal()) gender = models.StringField(initial=None, choices=[('a', 'a. Male'), ('b', 'b. Female'), ('c', 'c. Non-binary'), ('d', 'd. Other'), ('e', 'e. Prefer not to answer')], verbose_name='', widget=widgets.RadioSelect()) age = models.IntegerField(verbose_name='', min=18, max=110) work_experience = models.IntegerField(verbose_name='', min=0) major = models.StringField(verbose_name='') narcissism_1 = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) narcissism_2 = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) narcissism_3 = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) narcissism_4 = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) narcissism_5 = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) narcissism_6 = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) narcissism_7 = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) narcissism_8 = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) narcissism_9 = models.StringField(initial=None, choices=[('1', '1 = Strongly disagree.'), ('2', '2 '), ('3', '3 '), ('4', '4 = Neither agree nor disagree.'), ('5', '5 '), ('6', '6 '), ('7', '7 = Strongly agree.')], verbose_name='', widget=widgets.RadioSelectHorizontal()) class MgrAssignment(ExtraModel): manager_id = models.IntegerField() group_id = models.IntegerField() control_imposed = models.IntegerField() # FUNCTIONS def creating_session(subsession): session = subsession.session for player in subsession.get_players(): player.condition = session.config['condition'] player.participant.label = 'e' # PAGES class TaskInstructions2(Page): @staticmethod def before_next_page(player, timeout_happened): player.active_flag = 1 if player.condition == 2: player.condition_label = "Team" elif player.condition == 3: player.condition_label = "Full" class KnowledgeCheck2(Page): form_model = 'player' form_fields = ['kc4', 'kc5', 'kc6', 'kc7'] class MgrCheck(Page): @staticmethod def is_displayed(player): if player.mgr_ready == 0: return True else: return False @staticmethod def before_next_page(player, timeout_happened): conn = psycopg2.connect(database="d843cclkr6ovgn", user="uigdr2bmq9irl", password="pc314696db376127251d8f370b2d74d5c429ca12e964769f21ac05c08fc6b7ef6", host="cf9gid2f6uallg.cluster-czrs8kj4isg7.us-east-1.rds.amazonaws.com", port=5432) #conn = sqlite3.connect("db.sqlite3") str_session = str(player.session_id) cursor = conn.cursor() cursor.execute('select min(participant_id) from knowledge_of_effort_employee_s2_player where active_flag = 1' ' and session_id =' + str_session) this_participant = cursor.fetchone() # cursor.close() #Do the group processing only if it's the first participant, so a bunch aren't doing it at one time if this_participant[0] == player.participant_id: cursor.execute('select manager_id from knowledge_of_effort_manager_managerlist where do_not_pick = 0' ' and control_imposed = 9 ') mgr_not_ready = cursor.fetchone() # cursor.close() if mgr_not_ready is None: # Assign groups # Need a count of the active teams; those with active_flag=1; Don't need to worry about # session number because all employees will be active_flag = 0 until they start the experiment. cursor.execute('select distinct group_id from knowledge_of_effort_employee_s2_player ' 'where active_flag = 1 order by group_id') team_list = cursor.fetchall() num_teams = len(team_list) # cursor.close() # Get first and last group id cursor.execute('select min(group_id) as first_group, max(group_id) as last_group from ' 'knowledge_of_effort_employee_s2_player where active_flag = 1') team_identifiers = cursor.fetchone() first_team = team_identifiers[0] last_team = team_identifiers[1] # cursor.close() # Get mgrs who chose control and who didn't, and counts. cursor.execute('select manager_id from knowledge_of_effort_manager_managerlist where ' 'do_not_pick = 0 and control_imposed = 0') mgrs_no = cursor.fetchall() no_count = len(mgrs_no) # cursor.close() cursor.execute('select manager_id from knowledge_of_effort_manager_managerlist where ' 'do_not_pick = 0 and control_imposed = 1') mgrs_control = cursor.fetchall() control_count = len(mgrs_control) # cursor.close() # If there is at least one mgr who chose the control and at least one who did not..., if control_count > 0 and no_count > 0: # All the no control managers get the same group (go with the min group id) for row in mgrs_no: cursor.execute('insert into knowledge_of_effort_employee_s2_mgrassignment (manager_id, group_id, control_imposed) values ' '('+str(row[0])+', '+str(first_team)+' ,0)') conn.commit() # Divide up rest of the teams for the yes managers # Need to know which is bigger, number of teams or number of yes managers... if control_count > num_teams - 1: # If more control managers than teams, cycle through teams as needed i = 1 for row in mgrs_control: cursor.execute('insert into knowledge_of_effort_employee_s2_mgrassignment (manager_id, group_id, control_imposed) values ' '('+str(row[0])+', '+str(team_list[i][0])+', 1)') conn.commit() if i + 1 == num_teams: # If reached the end of the team list, reset that to the start i = 0 i += 1 elif num_teams - 1 > control_count: # More teams than control managers i = 0 j = -1 for row in team_list: if i > 0: # Skip first row since this group goes to the no control managers cursor.execute('insert into knowledge_of_effort_employee_s2_mgrassignment (manager_id, group_id, control_imposed) values ' '('+str(mgrs_control[j][0])+', '+str(row[0])+', 1)') conn.commit() if j + 1 == control_count: # If reached the end of the mgr list, reset that to the start j = -1 i += 1 j += 1 else: # Same number, then it's one for one i = 0 for row in team_list: if i > 0: cursor.execute('insert into knowledge_of_effort_employee_s2_mgrassignment (manager_id, group_id, control_imposed) values ' '(' + str(mgrs_control[i-1][0]) + ', ' + str(row[0]) + ', 1)') conn.commit() i += 1 # Otherwise if one of the groups has zero mgrs, just divide teams among that group... # No managers picked no control elif control_count > 0 and no_count == 0: if control_count > num_teams: i = 0 for row in mgrs_control: cursor.execute('insert into knowledge_of_effort_employee_s2_mgrassignment (manager_id, group_id, control_imposed) values ' '('+str(row[0])+', '+str(team_list[i][0])+', 1)') conn.commit() i += 1 if i == num_teams: i = 0 elif control_count < num_teams or control_count == num_teams: i = 0 for row in team_list: cursor.execute('insert into knowledge_of_effort_employee_s2_mgrassignment (manager_id, group_id, control_imposed) values ' '('+str(mgrs_control[i][0])+', '+str(row[0])+', 1)') conn.commit() i += 1 if i == control_count: i = 0 # All managers picked no control elif control_count == 0 and no_count > 0: if no_count > num_teams: i = 0 for row in mgrs_no: cursor.execute('insert into knowledge_of_effort_employee_s2_mgrassignment (manager_id, group_id, control_imposed) values ' '('+str(row[0])+', '+str(team_list[i][0])+', 0)') conn.commit() i += 1 if i == num_teams: i = 0 elif no_count < num_teams or no_count == num_teams: i = 0 for row in team_list: cursor.execute('insert into knowledge_of_effort_employee_s2_mgrassignment (manager_id, group_id, control_imposed) values ' '('+str(mgrs_no[i][0])+', '+str(row[0])+', 0)') conn.commit() i += 1 if i == no_count: i = 0 # Have to update manager_id in player table. Do that on next looping page # Update all employees to indicate managers are assigned. This will be every employee record in the same session # where active_flag = 1, since that is triggered back early in stage 1 and 'future' participants will # be showing as 0. Next auto-submit page update mgr_ready = 2 and will update manager_id and control in each # employee's record. cursor.execute('update knowledge_of_effort_employee_s2_player set mgr_ready = 1 where ' ' session_id = ' + str_session + ' and active_flag = 1') conn.commit() # Update managerlist table to set do_not_pick = 1 for this "sub-session" so that I don't have to do it manually cursor.execute('update knowledge_of_effort_manager_managerlist set do_not_pick = 1') conn.commit() cursor.close() conn.commit() conn.close() class MgrUpdate(Page): # This page will be reached when all managers/groups are matched. # Update manager_id and control in each employee's record. @staticmethod def is_displayed(player): if player.mgr_ready == 1: return True else: return False @staticmethod def before_next_page(player, timeout_happened): conn = psycopg2.connect(database="d843cclkr6ovgn", user="uigdr2bmq9irl", password="pc314696db376127251d8f370b2d74d5c429ca12e964769f21ac05c08fc6b7ef6", host="cf9gid2f6uallg.cluster-czrs8kj4isg7.us-east-1.rds.amazonaws.com", port=5432) #conn = sqlite3.connect("db.sqlite3") str_participant_id = str(player.participant_id) cursor = conn.cursor() cursor.execute('select m.manager_id, control_imposed from knowledge_of_effort_employee_s2_player p inner join' ' knowledge_of_effort_employee_s2_mgrassignment m on p.group_id = m.group_id where' ' p.participant_id =' + str_participant_id) this_participant = cursor.fetchone() player.manager_id = this_participant[0] player.s2_control = this_participant[1] cursor.close() conn.commit() conn.close() player.mgr_ready = 2 class Decision2(Page): form_model = 'player' form_fields = ['s2_contribution', 's2_decision_time'] def before_next_page(player, timeout_happened): player.s2_pay = 2.00 - player.s2_contribution player.total_pay = player.s1_pay + player.s2_pay player.active_flag = 2 #So manager check can find these who are complete but in the "active" session class GroupWait(WaitPage): #Make sure using forward slash in template name! #template_name = 'helping_behavior_employee_task/CWaitPage2.html' body_text = "Please wait briefly while others in your group arrive..." title_text = "" group_by_arrival_time = True @staticmethod def after_all_players_arrive(group: Group): p1 = group.get_player_by_id(1) p2 = group.get_player_by_id(2) p3 = group.get_player_by_id(3) p1.s1_contribution = p1.participant.s1_contribution p1.s1_decision_time = p1.participant.s1_decision_time p1.s1_pay = p1.participant.s1_pay p1.participant_number = p1.participant.participant_number # p1.manager_id = p1.participant.manager_id p2.s1_contribution = p2.participant.s1_contribution p2.s1_decision_time = p2.participant.s1_decision_time p2.s1_pay = p2.participant.s1_pay p2.participant_number = p2.participant.participant_number # p2.manager_id = p2.participant.manager_id p3.s1_contribution = p3.participant.s1_contribution p3.s1_decision_time = p3.participant.s1_decision_time p3.s1_pay = p3.participant.s1_pay p3.participant_number = p3.participant.participant_number # p3.manager_id = p3.participant.manager_id p1.s1_coworker_1_contribution = p2.s1_contribution p1.s1_coworker_2_contribution = p3.s1_contribution p2.s1_coworker_1_contribution = p1.s1_contribution p2.s1_coworker_2_contribution = p3.s1_contribution p3.s1_coworker_1_contribution = p1.s1_contribution p3.s1_coworker_2_contribution = p2.s1_contribution p1.s1_team_contribution = p1.s1_contribution + p2.s1_contribution + p3.s1_contribution p2.s1_team_contribution = p1.s1_team_contribution p3.s1_team_contribution = p1.s1_team_contribution class PEQ1(Page): form_model = 'player' form_fields = ['downward_trust', 'downward_trust_coworkers', 'upward_trust','horizontal_trust','manager_affinity', 'coworkers_high_contributions', 'team_identification', 'coworker_affinity', 'manager_priority', 'manager_priority_magnitude', 'manager_control', 'control_attribution', 'attribution_magnitude', 's2_autonomy', 's2_mgr_intrusion', 's2_mgr_fairness','s2_control_fairness', 's2_coworker_equity', 's2_manager_bonus', 's2_right_thing', 's2_coworker_competition'] class PEQ2(Page): form_model = 'player' @staticmethod def get_form_fields(player): if player.s2_control == 1: return ['s2_mgr_expectations', 's2_coworker_info_effect', 'control_reaction','manager_motivation', 'helping_energizes', 'helping_importance', 'helping_preference', 'best_while_helping', 'like_helping', 'affect_enthusiastic', 'affect_upset', 'affect_interested', 'affect_distressed', 'affect_determined', 'affect_nervous', 'gender', 'age', 'work_experience', 'major'] else: return ['s2_mgr_expectations', 's2_coworker_info_effect', 'helping_energizes', 'helping_importance', 'helping_preference', 'best_while_helping', 'like_helping', 'affect_enthusiastic', 'affect_upset', 'affect_interested', 'affect_distressed', 'affect_determined', 'affect_nervous', 'gender', 'age', 'work_experience', 'major'] class ExitResults(Page): pass page_sequence = \ [ GroupWait, TaskInstructions2, KnowledgeCheck2, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrCheck, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, MgrUpdate, Decision2, PEQ1, PEQ2, ExitResults ]