from otree.api import Currency as c, currency_range from . import models from ._builtin import Page, WaitPage from .models import Constants import random from random import shuffle import itertools from decimal import * def vars_for_all_templates(self): return { 'condition': self.participant.vars['condition'], 'type': self.participant.vars['type'] } class GroupWait(WaitPage): template_name = 'cost_reporting_task/CWaitPageG.html' body_text = "Please wait briefly while the other Manager arrives...(Note: You will be compensated for waiting " \ "(at $0.20/minute) and will wait a maximum of 5 minutes)..." title_text = "" #group_by_arrival_time = True #def get_players_for_group(self, waiting_players): # a_mgrs_1 = [p for p in waiting_players if p.participant.vars['type'] == 1 and p.participant.vars['condition'] == 5] # a_mgrs_2 = [p for p in waiting_players if p.participant.vars['type'] == 1 and p.participant.vars['condition'] == 6] # a_mgrs_3 = [p for p in waiting_players if p.participant.vars['type'] == 1 and p.participant.vars['condition'] == 7] # a_mgrs_4 = [p for p in waiting_players if p.participant.vars['type'] == 1 and p.participant.vars['condition'] == 8] # b_mgrs_1 = [p for p in waiting_players if p.participant.vars['type'] == 2 and p.participant.vars['condition'] == 5] # b_mgrs_2 = [p for p in waiting_players if p.participant.vars['type'] == 2 and p.participant.vars['condition'] == 6] # b_mgrs_3 = [p for p in waiting_players if p.participant.vars['type'] == 2 and p.participant.vars['condition'] == 7] # b_mgrs_4 = [p for p in waiting_players if p.participant.vars['type'] == 2 and p.participant.vars['condition'] == 8] # if len(a_mgrs_1) > 0 and len(b_mgrs_1) > 0: # return [a_mgrs_1[0], b_mgrs_1[0]] # if len(a_mgrs_2) > 0 and len(b_mgrs_2) > 0: # return [a_mgrs_2[0], b_mgrs_2[0]] # if len(a_mgrs_3) > 0 and len(b_mgrs_3) > 0: # return [a_mgrs_3[0], b_mgrs_3[0]] # if len(a_mgrs_4) > 0 and len(b_mgrs_4) > 0: # return [a_mgrs_4[0], b_mgrs_4[0]] class Pre_Task(Page): def before_next_page(self): self.player.actual_1A = 50000 self.player.actual_1B = 50000 self.player.actual_2A = 30000 self.player.actual_2B = 30000 self.player.actual_3A = 70000 self.player.actual_3B = 70000 self.player.actual_4A = 50000 self.player.actual_4B = 50000 self.player.actual_5A = 80000 self.player.actual_5B = 80000 self.player.condition = self.participant.vars['condition'] self.player.type = self.participant.vars['type'] self.player.worker_id = self.participant.vars['worker_id'] partner = self.player.get_partner() self.player.partner_id = partner.participant_id class ChatWait(WaitPage): template_name = 'cost_reporting_task/CWaitPage.html' body_text = "Please wait briefly while the other Manager arrives...(Note: You will be compensated for waiting " \ "(at $0.20/minute) and will wait a maximum of 5 minutes)..." title_text = "" class Cost_Info(Page): form_model = models.Player form_fields = ['chat_time_1'] class Report1A(Page): form_model = models.Player form_fields = ['report_1A', 'report_1B'] def is_displayed(self): if self.player.type == 1: return True else: return False # Update partner's data def before_next_page(self): models.Player.objects.filter(participant_id=self.player.partner_id).update(report_1A_partner=self.player.report_1A, report_1B_partner=self.player.report_1B) class WaitReport1A(WaitPage): template_name = 'cost_reporting_task/CWaitPage.html' body_text = "Please wait briefly while the other Manager makes their cost reports..." title_text = "" class Report1B(Page): form_model = models.Player form_fields = ['report_1A', 'report_1B'] def is_displayed(self): if self.player.type == 2: return True else: return False # Update partner's data def before_next_page(self): models.Player.objects.filter(participant_id=self.player.partner_id).update(report_1A_partner=self.player.report_1A, report_1B_partner=self.player.report_1B) # Can determine outcomes now that Manager B has reported, so do that before moving to results page # mgr_data = models.Player.objects.get(id=self.player.id) if self.player.report_1A != self.player.report_1A_partner: audit_1A = 1 else: audit_1A = 0 if self.player.report_1B != self.player.report_1B_partner: audit_1B = 1 else: audit_1B = 0 self.player.audit_flag_1A = audit_1A self.player.audit_flag_1B = audit_1B if audit_1A == 1 and self.player.report_1A != self.player.actual_1A: self.player.bust_1A = 1 else: self.player.bust_1A = 0 if audit_1B == 1 and self.player.report_1B != self.player.actual_1B: self.player.bust_1B = 1 else: self.player.bust_1B = 0 if audit_1A == 1 and self.player.report_1A_partner != self.player.actual_1A: self.player.bust_1A_partner = 1 else: self.player.bust_1A_partner = 0 if audit_1B == 1 and self.player.report_1B_partner != self.player.actual_1B: self.player.bust_1B_partner = 1 else: self.player.bust_1B_partner = 0 if self.player.condition == 7 or self.player.condition == 8: #No shared interest # This is always Manager B hitting this page, so easy to know whose data to look at if audit_1A == 0 and self.player.report_1A_partner > self.player.actual_1A: self.player.slack_1A = self.player.report_1A_partner - self.player.actual_1A self.player.slack_dol_1A = Decimal(self.player.slack_1A / 5000) * Decimal(0.25) else: self.player.slack_1A = 0 self.player.slack_dol_1A = 0.00 if audit_1B == 0 and self.player.report_1B > self.player.actual_1B: self.player.slack_1B = self.player.report_1B_partner - self.player.actual_1B self.player.slack_dol_1B = Decimal(self.player.slack_1B / 5000) * Decimal(0.25) else: self.player.slack_1B = 0 self.player.slack_dol_1B = 0.00 # Also need to update reporting outcomes, potential lira, and potential comp... if self.player.bust_1A == 1 or self.player.bust_1B == 1: potential_lira = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_1A == 0 and self.player.audit_flag_1B == 0: if self.player.slack_1B > 0: potential_lira = self.player.slack_1B + 30000 else: potential_lira = 30000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_1B == 1 and self.player.audit_flag_1A == 0: potential_lira = 120000 elif self.player.audit_flag_1A == 1 and self.player.audit_flag_1B == 0: # Could have slack if self.player.slack_1B > 0: potential_lira = self.player.slack_1B + 120000 else: potential_lira = 120000 elif self.player.audit_flag_1A == 1 and self.player.audit_flag_1B == 1: potential_lira = 210000 potential_comp = Decimal(potential_lira / 5000) * Decimal(0.25) self.player.lira_1 = potential_lira self.player.potential_comp_1 = potential_comp # Same for Manager A... if self.player.bust_1A_partner == 1 or self.player.bust_1B_partner == 1: potential_lira_partner = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_1A == 0 and self.player.audit_flag_1B == 0: if self.player.slack_1A > 0: potential_lira_partner = self.player.slack_1A + 30000 else: potential_lira_partner = 30000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_1A == 1 and self.player.audit_flag_1B == 0: potential_lira_partner = 120000 elif self.player.audit_flag_1B == 1 and self.player.audit_flag_1A == 0: # Could have slack if self.player.slack_1A > 0: potential_lira_partner = self.player.slack_1A + 120000 else: potential_lira_partner = 120000 elif self.player.audit_flag_1A == 1 and self.player.audit_flag_1B == 1: potential_lira_partner = 210000 potential_comp_partner = Decimal(potential_lira_partner / 5000) * Decimal(0.25) self.player.lira_1_partner = potential_lira_partner self.player.potential_comp_1_partner = potential_comp_partner else: #Shared interest with other conversion rate # This is always Manager B hitting this page, so easy to know whose data to look at # Shared interest, have to split the slack - but leave the raw slack as-is if audit_1A == 0 and self.player.report_1A_partner > self.player.actual_1A: self.player.slack_1A = self.player.report_1A_partner - self.player.actual_1A self.player.slack_dol_1A = Decimal(self.player.slack_1A / 5000) * Decimal(0.50) else: self.player.slack_1A = 0 self.player.slack_dol_1A = 0.00 if audit_1B == 0 and self.player.report_1B > self.player.actual_1B: self.player.slack_1B = self.player.report_1B_partner - self.player.actual_1B self.player.slack_dol_1B = Decimal(self.player.slack_1B / 5000) * Decimal(0.50) else: self.player.slack_1B = 0 self.player.slack_dol_1B = 0.00 # Also need to update reporting outcomes, potential lira, and potential comp... if self.player.bust_1A == 1 or self.player.bust_1B == 1: potential_lira = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_1A == 0 and self.player.audit_flag_1B == 0: if self.player.slack_1B > 0: potential_lira = int(self.player.slack_1B / 2) + 15000 else: potential_lira = 15000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_1B == 1 and self.player.audit_flag_1A == 0: potential_lira = 60000 elif self.player.audit_flag_1A == 1 and self.player.audit_flag_1B == 0: # Could have slack if self.player.slack_1B > 0: potential_lira = int(self.player.slack_1B / 2) + 60000 else: potential_lira = 60000 elif self.player.audit_flag_1A == 1 and self.player.audit_flag_1B == 1: potential_lira = 105000 potential_comp = Decimal(potential_lira / 5000) * Decimal(0.50) self.player.lira_1 = potential_lira self.player.potential_comp_1 = potential_comp # Same for Manager A... if self.player.bust_1A_partner == 1 or self.player.bust_1B_partner == 1: potential_lira_partner = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_1A == 0 and self.player.audit_flag_1B == 0: if self.player.slack_1A > 0: potential_lira_partner = int(self.player.slack_1A / 2) + 15000 else: potential_lira_partner = 15000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_1A == 1 and self.player.audit_flag_1B == 0: potential_lira_partner = 60000 elif self.player.audit_flag_1B == 1 and self.player.audit_flag_1A == 0: # Could have slack if self.player.slack_1A > 0: potential_lira_partner = int(self.player.slack_1A / 2) + 60000 else: potential_lira_partner = 60000 elif self.player.audit_flag_1A == 1 and self.player.audit_flag_1B == 1: potential_lira_partner = 105000 potential_comp_partner = Decimal(potential_lira_partner / 5000) * Decimal(0.50) self.player.lira_1_partner = potential_lira_partner self.player.potential_comp_1_partner = potential_comp_partner if self.player.lira_1 == 0: self.player.slack_1B = 0 self.player.slack_dol_1B = 0.00 if self.player.lira_1_partner == 0: self.player.slack_1A = 0 self.player.slack_dol_1A = 0.00 # ...then update Manager A's stuff on the way out models.Player.objects.filter(participant_id=self.player.partner_id).update(audit_flag_1A=self.player.audit_flag_1A, audit_flag_1B=self.player.audit_flag_1B, slack_1A=self.player.slack_1A, slack_dol_1A=self.player.slack_dol_1A, slack_1B=self.player.slack_1B, slack_dol_1B=self.player.slack_dol_1B, bust_1A=self.player.bust_1A_partner, bust_1A_partner=self.player.bust_1A, bust_1B=self.player.bust_1B_partner, bust_1B_partner=self.player.bust_1B, lira_1=self.player.lira_1_partner, potential_comp_1=self.player.potential_comp_1_partner, lira_1_partner=self.player.lira_1, potential_comp_1_partner=self.player.potential_comp_1) class WaitReport1B(WaitPage): template_name = 'cost_reporting_task/CWaitPage.html' body_text = "Please wait briefly while the other Manager makes their cost reports..." title_text = "" class Reporting_Results(Page): def vars_for_template(self): return {'slack_1A_share': int(self.player.slack_1A / 2), 'slack_1B_share': int(self.player.slack_1B / 2)} class Cost_Info_2(Page): form_model = models.Player form_fields = ['chat_time_2'] class Report2A(Page): form_model = models.Player form_fields = ['report_2A', 'report_2B'] def is_displayed(self): if self.player.type == 1: return True else: return False # Update partner's data def before_next_page(self): models.Player.objects.filter(participant_id=self.player.partner_id).update(report_2A_partner=self.player.report_2A, report_2B_partner=self.player.report_2B) class WaitReport2A(WaitPage): template_name = 'cost_reporting_task/CWaitPage.html' body_text = "Please wait briefly while the other Manager makes their cost reports..." title_text = "" class Report2B(Page): form_model = models.Player form_fields = ['report_2A', 'report_2B'] def is_displayed(self): if self.player.type == 2: return True else: return False # Update partner's data def before_next_page(self): models.Player.objects.filter(participant_id=self.player.partner_id).update(report_2A_partner=self.player.report_2A, report_2B_partner=self.player.report_2B) # Can determine outcomes now that Manager B has reported, so do that before moving to results page # mgr_data = models.Player.objects.get(participant_id=self.player.id) if self.player.report_2A != self.player.report_2A_partner: audit_2A = 1 else: audit_2A = 0 if self.player.report_2B != self.player.report_2B_partner: audit_2B = 1 else: audit_2B = 0 self.player.audit_flag_2A = audit_2A self.player.audit_flag_2B = audit_2B if audit_2A == 1 and self.player.report_2A != self.player.actual_2A: self.player.bust_2A = 1 else: self.player.bust_2A = 0 if audit_2B == 1 and self.player.report_2B != self.player.actual_2B: self.player.bust_2B = 1 else: self.player.bust_2B = 0 if audit_2A == 1 and self.player.report_2A_partner != self.player.actual_2A: self.player.bust_2A_partner = 1 else: self.player.bust_2A_partner = 0 if audit_2B == 1 and self.player.report_2B_partner != self.player.actual_2B: self.player.bust_2B_partner = 1 else: self.player.bust_2B_partner = 0 if self.player.condition == 7 or self.player.condition == 8: # No shared interest # This is always Manager B hitting this page, so easy to know whose data to look at if audit_2A == 0 and self.player.report_2A_partner > self.player.actual_2A: self.player.slack_2A = self.player.report_2A_partner - self.player.actual_2A self.player.slack_dol_2A = Decimal(self.player.slack_2A / 5000) * Decimal(0.25) else: self.player.slack_2A = 0 self.player.slack_dol_2A = 0.00 if audit_2B == 0 and self.player.report_2B > self.player.actual_2B: self.player.slack_2B = self.player.report_2B_partner - self.player.actual_2B self.player.slack_dol_2B = Decimal(self.player.slack_2B / 5000) * Decimal(0.25) else: self.player.slack_2B = 0 self.player.slack_dol_2B = 0.00 # Also need to update reporting outcomes, potential lira, and potential comp... if self.player.bust_2A == 1 or self.player.bust_2B == 1: potential_lira = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_2A == 0 and self.player.audit_flag_2B == 0: if self.player.slack_2B > 0: potential_lira = self.player.slack_2B + 30000 else: potential_lira = 30000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_2B == 1 and self.player.audit_flag_2A == 0: potential_lira = 120000 elif self.player.audit_flag_2A == 1 and self.player.audit_flag_2B == 0: # Could have slack if self.player.slack_2B > 0: potential_lira = self.player.slack_2B + 120000 else: potential_lira = 120000 elif self.player.audit_flag_2A == 1 and self.player.audit_flag_2B == 1: potential_lira = 210000 potential_comp = Decimal(potential_lira / 5000) * Decimal(0.25) self.player.lira_2 = potential_lira self.player.potential_comp_2 = potential_comp # Same for Manager A... if self.player.bust_2A_partner == 1 or self.player.bust_2B_partner == 1: potential_lira_partner = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_2A == 0 and self.player.audit_flag_2B == 0: if self.player.slack_2A > 0: potential_lira_partner = self.player.slack_2A + 30000 else: potential_lira_partner = 30000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_2A == 1 and self.player.audit_flag_2B == 0: potential_lira_partner = 120000 elif self.player.audit_flag_2B == 1 and self.player.audit_flag_2A == 0: # Could have slack if self.player.slack_2A > 0: potential_lira_partner = self.player.slack_2A + 120000 else: potential_lira_partner = 120000 elif self.player.audit_flag_2A == 1 and self.player.audit_flag_2B == 1: potential_lira_partner = 210000 potential_comp_partner = Decimal(potential_lira_partner / 5000) * Decimal(0.25) self.player.lira_2_partner = potential_lira_partner self.player.potential_comp_2_partner = potential_comp_partner else: # Shared interest with other conversion rate # This is always Manager B hitting this page, so easy to know whose data to look at # Shared interest, have to split the slack - but leave the raw slack as-is if audit_2A == 0 and self.player.report_2A_partner > self.player.actual_2A: self.player.slack_2A = self.player.report_2A_partner - self.player.actual_2A self.player.slack_dol_2A = Decimal(self.player.slack_2A / 5000) * Decimal(0.50) else: self.player.slack_2A = 0 self.player.slack_dol_2A = 0.00 if audit_2B == 0 and self.player.report_2B > self.player.actual_2B: self.player.slack_2B = self.player.report_2B_partner - self.player.actual_2B self.player.slack_dol_2B = Decimal(self.player.slack_2B / 5000) * Decimal(0.50) else: self.player.slack_2B = 0 self.player.slack_dol_2B = 0.00 # Also need to update reporting outcomes, potential lira, and potential comp... if self.player.bust_2A == 1 or self.player.bust_2B == 1: potential_lira = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_2A == 0 and self.player.audit_flag_2B == 0: if self.player.slack_2B > 0: potential_lira = int(self.player.slack_2B / 2) + 15000 else: potential_lira = 15000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_2B == 1 and self.player.audit_flag_2A == 0: potential_lira = 60000 elif self.player.audit_flag_2A == 1 and self.player.audit_flag_2B == 0: # Could have slack if self.player.slack_2B > 0: potential_lira = int(self.player.slack_2B / 2) + 60000 else: potential_lira = 60000 elif self.player.audit_flag_2A == 1 and self.player.audit_flag_2B == 1: potential_lira = 105000 potential_comp = Decimal(potential_lira / 5000) * Decimal(0.50) self.player.lira_2 = potential_lira self.player.potential_comp_2 = potential_comp # Same for Manager A... if self.player.bust_2A_partner == 1 or self.player.bust_2B_partner == 1: potential_lira_partner = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_2A == 0 and self.player.audit_flag_2B == 0: if self.player.slack_2A > 0: potential_lira_partner = int(self.player.slack_2A / 2) + 15000 else: potential_lira_partner = 15000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_2A == 1 and self.player.audit_flag_2B == 0: potential_lira_partner = 60000 elif self.player.audit_flag_2B == 1 and self.player.audit_flag_2A == 0: # Could have slack if self.player.slack_2A > 0: potential_lira_partner = int(self.player.slack_2A / 2) + 60000 else: potential_lira_partner = 60000 elif self.player.audit_flag_2A == 1 and self.player.audit_flag_2B == 1: potential_lira_partner = 105000 potential_comp_partner = Decimal(potential_lira_partner / 5000) * Decimal(0.50) self.player.lira_2_partner = potential_lira_partner self.player.potential_comp_2_partner = potential_comp_partner if self.player.lira_2 == 0: self.player.slack_2B = 0 self.player.slack_dol_2B = 0.00 if self.player.lira_2_partner == 0: self.player.slack_2A = 0 self.player.slack_dol_2A = 0.00 # ...then update Manager A's stuff on the way out models.Player.objects.filter(participant_id=self.player.partner_id).update(audit_flag_2A=self.player.audit_flag_2A, audit_flag_2B=self.player.audit_flag_2B, slack_2A=self.player.slack_2A, slack_dol_2A=self.player.slack_dol_2A, slack_2B=self.player.slack_2B, slack_dol_2B=self.player.slack_dol_2B, bust_2A=self.player.bust_2A_partner, bust_2A_partner=self.player.bust_2A, bust_2B=self.player.bust_2B_partner, bust_2B_partner=self.player.bust_2B, lira_2=self.player.lira_2_partner, potential_comp_2=self.player.potential_comp_2_partner, lira_2_partner=self.player.lira_2, potential_comp_2_partner=self.player.potential_comp_2) class WaitReport2B(WaitPage): template_name = 'cost_reporting_task/CWaitPage.html' body_text = "Please wait briefly while the other Manager makes their cost reports..." title_text = "" class Reporting_Results_2(Page): def vars_for_template(self): return {'slack_2A_share': int(self.player.slack_2A / 2), 'slack_2B_share': int(self.player.slack_2B / 2)} class Cost_Info_3(Page): form_model = models.Player form_fields = ['chat_time_3'] class Report3A(Page): form_model = models.Player form_fields = ['report_3A', 'report_3B'] def is_displayed(self): if self.player.type == 1: return True else: return False # Update partner's data def before_next_page(self): models.Player.objects.filter(participant_id=self.player.partner_id).update(report_3A_partner=self.player.report_3A, report_3B_partner=self.player.report_3B) class WaitReport3A(WaitPage): template_name = 'cost_reporting_task/CWaitPage2.html' body_text = "Please wait briefly while the other Manager makes their cost reports..." title_text = "" class Report3B(Page): form_model = models.Player form_fields = ['report_3A', 'report_3B'] def is_displayed(self): if self.player.type == 2: return True else: return False # Update partner's data def before_next_page(self): models.Player.objects.filter(participant_id=self.player.partner_id).update(report_3A_partner=self.player.report_3A, report_3B_partner=self.player.report_3B) # Can determine outcomes now that Manager B has reported, so do that before moving to results page # mgr_data = models.Player.objects.get(id=self.player.id) if self.player.report_3A != self.player.report_3A_partner: audit_3A = 1 else: audit_3A = 0 if self.player.report_3B != self.player.report_3B_partner: audit_3B = 1 else: audit_3B = 0 self.player.audit_flag_3A = audit_3A self.player.audit_flag_3B = audit_3B if audit_3A == 1 and self.player.report_3A != self.player.actual_3A: self.player.bust_3A = 1 else: self.player.bust_3A = 0 if audit_3B == 1 and self.player.report_3B != self.player.actual_3B: self.player.bust_3B = 1 else: self.player.bust_3B = 0 if audit_3A == 1 and self.player.report_3A_partner != self.player.actual_3A: self.player.bust_3A_partner = 1 else: self.player.bust_3A_partner = 0 if audit_3B == 1 and self.player.report_3B_partner != self.player.actual_3B: self.player.bust_3B_partner = 1 else: self.player.bust_3B_partner = 0 if self.player.condition == 7 or self.player.condition == 8: # No shared interest # This is always Manager B hitting this page, so easy to know whose data to look at if audit_3A == 0 and self.player.report_3A_partner > self.player.actual_3A: self.player.slack_3A = self.player.report_3A_partner - self.player.actual_3A self.player.slack_dol_3A = Decimal(self.player.slack_3A / 5000) * Decimal(0.25) else: self.player.slack_3A = 0 self.player.slack_dol_3A = 0.00 if audit_3B == 0 and self.player.report_3B > self.player.actual_3B: self.player.slack_3B = self.player.report_3B_partner - self.player.actual_3B self.player.slack_dol_3B = Decimal(self.player.slack_3B / 5000) * Decimal(0.25) else: self.player.slack_3B = 0 self.player.slack_dol_3B = 0.00 # Also need to update reporting outcomes, potential lira, and potential comp... if self.player.bust_3A == 1 or self.player.bust_3B == 1: potential_lira = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_3A == 0 and self.player.audit_flag_3B == 0: if self.player.slack_3B > 0: potential_lira = self.player.slack_3B + 30000 else: potential_lira = 30000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_3B == 1 and self.player.audit_flag_3A == 0: potential_lira = 120000 elif self.player.audit_flag_3A == 1 and self.player.audit_flag_3B == 0: # Could have slack if self.player.slack_3B > 0: potential_lira = self.player.slack_3B + 120000 else: potential_lira = 120000 elif self.player.audit_flag_3A == 1 and self.player.audit_flag_3B == 1: potential_lira = 210000 potential_comp = Decimal(potential_lira / 5000) * Decimal(0.25) self.player.lira_3 = potential_lira self.player.potential_comp_3 = potential_comp # Same for Manager A... if self.player.bust_3A_partner == 1 or self.player.bust_3B_partner == 1: potential_lira_partner = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_3A == 0 and self.player.audit_flag_3B == 0: if self.player.slack_3A > 0: potential_lira_partner = self.player.slack_3A + 30000 else: potential_lira_partner = 30000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_3A == 1 and self.player.audit_flag_3B == 0: potential_lira_partner = 120000 elif self.player.audit_flag_3B == 1 and self.player.audit_flag_3A == 0: # Could have slack if self.player.slack_3A > 0: potential_lira_partner = self.player.slack_3A + 120000 else: potential_lira_partner = 120000 elif self.player.audit_flag_3A == 1 and self.player.audit_flag_3B == 1: potential_lira_partner = 210000 potential_comp_partner = Decimal(potential_lira_partner / 5000) * Decimal(0.25) self.player.lira_3_partner = potential_lira_partner self.player.potential_comp_3_partner = potential_comp_partner else: # Shared interest with other conversion rate # This is always Manager B hitting this page, so easy to know whose data to look at # Shared interest, have to split the slack - but leave the raw slack as-is if audit_3A == 0 and self.player.report_3A_partner > self.player.actual_3A: self.player.slack_3A = self.player.report_3A_partner - self.player.actual_3A self.player.slack_dol_3A = Decimal(self.player.slack_3A / 5000) * Decimal(0.50) else: self.player.slack_3A = 0 self.player.slack_dol_3A = 0.00 if audit_3B == 0 and self.player.report_3B > self.player.actual_3B: self.player.slack_3B = self.player.report_3B_partner - self.player.actual_3B self.player.slack_dol_3B = Decimal(self.player.slack_3B / 5000) * Decimal(0.50) else: self.player.slack_3B = 0 self.player.slack_dol_3B = 0.00 # Also need to update reporting outcomes, potential lira, and potential comp... if self.player.bust_3A == 1 or self.player.bust_3B == 1: potential_lira = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_3A == 0 and self.player.audit_flag_3B == 0: if self.player.slack_3B > 0: potential_lira = int(self.player.slack_3B / 2) + 15000 else: potential_lira = 15000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_3B == 1 and self.player.audit_flag_3A == 0: potential_lira = 60000 elif self.player.audit_flag_3A == 1 and self.player.audit_flag_3B == 0: # Could have slack if self.player.slack_3B > 0: potential_lira = int(self.player.slack_3B / 2) + 60000 else: potential_lira = 60000 elif self.player.audit_flag_3A == 1 and self.player.audit_flag_3B == 1: potential_lira = 105000 potential_comp = Decimal(potential_lira / 5000) * Decimal(0.50) self.player.lira_3 = potential_lira self.player.potential_comp_3 = potential_comp # Same for Manager A... if self.player.bust_3A_partner == 1 or self.player.bust_3B_partner == 1: potential_lira_partner = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_3A == 0 and self.player.audit_flag_3B == 0: if self.player.slack_3A > 0: potential_lira_partner = int(self.player.slack_3A / 2) + 15000 else: potential_lira_partner = 15000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_3A == 1 and self.player.audit_flag_3B == 0: potential_lira_partner = 60000 elif self.player.audit_flag_3B == 1 and self.player.audit_flag_3A == 0: # Could have slack if self.player.slack_3A > 0: potential_lira_partner = int(self.player.slack_3A / 2) + 60000 else: potential_lira_partner = 60000 elif self.player.audit_flag_3A == 1 and self.player.audit_flag_3B == 1: potential_lira_partner = 105000 potential_comp_partner = Decimal(potential_lira_partner / 5000) * Decimal(0.50) self.player.lira_3_partner = potential_lira_partner self.player.potential_comp_3_partner = potential_comp_partner if self.player.lira_3 == 0: self.player.slack_3B = 0 self.player.slack_dol_3B = 0.00 if self.player.lira_3_partner == 0: self.player.slack_3A = 0 self.player.slack_dol_3A = 0.00 # ...then update Manager A's stuff on the way out models.Player.objects.filter(participant_id=self.player.partner_id).update(audit_flag_3A=self.player.audit_flag_3A, audit_flag_3B=self.player.audit_flag_3B, slack_3A=self.player.slack_3A, slack_dol_3A=self.player.slack_dol_3A, slack_3B=self.player.slack_3B, slack_dol_3B=self.player.slack_dol_3B, bust_3A=self.player.bust_3A_partner, bust_3A_partner=self.player.bust_3A, bust_3B=self.player.bust_3B_partner, bust_3B_partner=self.player.bust_3B, lira_3=self.player.lira_3_partner, potential_comp_3=self.player.potential_comp_3_partner, lira_3_partner=self.player.lira_3, potential_comp_3_partner=self.player.potential_comp_3) class WaitReport3B(WaitPage): template_name = 'cost_reporting_task/CWaitPage2.html' body_text = "Please wait briefly while the other Manager makes their cost reports..." title_text = "" class Reporting_Results_3(Page): def vars_for_template(self): return {'slack_3A_share': int(self.player.slack_3A / 2), 'slack_3B_share': int(self.player.slack_3B / 2)} class Cost_Info_4(Page): form_model = models.Player form_fields = ['chat_time_4'] class Report4A(Page): form_model = models.Player form_fields = ['report_4A', 'report_4B'] def is_displayed(self): if self.player.type == 1: return True else: return False # Update partner's data def before_next_page(self): models.Player.objects.filter(participant_id=self.player.partner_id).update(report_4A_partner=self.player.report_4A, report_4B_partner=self.player.report_4B) class WaitReport4A(WaitPage): template_name = 'cost_reporting_task/CWaitPage2.html' body_text = "Please wait briefly while the other Manager makes their cost reports..." title_text = "" class Report4B(Page): form_model = models.Player form_fields = ['report_4A', 'report_4B'] def is_displayed(self): if self.player.type == 2: return True else: return False # Update partner's data def before_next_page(self): models.Player.objects.filter(participant_id=self.player.partner_id).update(report_4A_partner=self.player.report_4A, report_4B_partner=self.player.report_4B) # Can determine outcomes now that Manager B has reported, so do that before moving to results page # mgr_data = models.Player.objects.get(id=self.player.id) if self.player.report_4A != self.player.report_4A_partner: audit_4A = 1 else: audit_4A = 0 if self.player.report_4B != self.player.report_4B_partner: audit_4B = 1 else: audit_4B = 0 self.player.audit_flag_4A = audit_4A self.player.audit_flag_4B = audit_4B if audit_4A == 1 and self.player.report_4A != self.player.actual_4A: self.player.bust_4A = 1 else: self.player.bust_4A = 0 if audit_4B == 1 and self.player.report_4B != self.player.actual_4B: self.player.bust_4B = 1 else: self.player.bust_4B = 0 if audit_4A == 1 and self.player.report_4A_partner != self.player.actual_4A: self.player.bust_4A_partner = 1 else: self.player.bust_4A_partner = 0 if audit_4B == 1 and self.player.report_4B_partner != self.player.actual_4B: self.player.bust_4B_partner = 1 else: self.player.bust_4B_partner = 0 if self.player.condition == 7 or self.player.condition == 8: # No shared interest # This is always Manager B hitting this page, so easy to know whose data to look at if audit_4A == 0 and self.player.report_4A_partner > self.player.actual_4A: self.player.slack_4A = self.player.report_4A_partner - self.player.actual_4A self.player.slack_dol_4A = Decimal(self.player.slack_4A / 5000) * Decimal(0.25) else: self.player.slack_4A = 0 self.player.slack_dol_4A = 0.00 if audit_4B == 0 and self.player.report_4B > self.player.actual_4B: self.player.slack_4B = self.player.report_4B_partner - self.player.actual_4B self.player.slack_dol_4B = Decimal(self.player.slack_4B / 5000) * Decimal(0.25) else: self.player.slack_4B = 0 self.player.slack_dol_4B = 0.00 # Also need to update reporting outcomes, potential lira, and potential comp... if self.player.bust_4A == 1 or self.player.bust_4B == 1: potential_lira = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_4A == 0 and self.player.audit_flag_4B == 0: if self.player.slack_4B > 0: potential_lira = self.player.slack_4B + 30000 else: potential_lira = 30000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_4B == 1 and self.player.audit_flag_4A == 0: potential_lira = 120000 elif self.player.audit_flag_4A == 1 and self.player.audit_flag_4B == 0: # Could have slack if self.player.slack_4B > 0: potential_lira = self.player.slack_4B + 120000 else: potential_lira = 120000 elif self.player.audit_flag_4A == 1 and self.player.audit_flag_4B == 1: potential_lira = 210000 potential_comp = Decimal(potential_lira / 5000) * Decimal(0.25) self.player.lira_4 = potential_lira self.player.potential_comp_4 = potential_comp # Same for Manager A... if self.player.bust_4A_partner == 1 or self.player.bust_4B_partner == 1: potential_lira_partner = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_4A == 0 and self.player.audit_flag_4B == 0: if self.player.slack_4A > 0: potential_lira_partner = self.player.slack_4A + 30000 else: potential_lira_partner = 30000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_4A == 1 and self.player.audit_flag_4B == 0: potential_lira_partner = 120000 elif self.player.audit_flag_4B == 1 and self.player.audit_flag_4A == 0: # Could have slack if self.player.slack_4A > 0: potential_lira_partner = self.player.slack_4A + 120000 else: potential_lira_partner = 120000 elif self.player.audit_flag_4A == 1 and self.player.audit_flag_4B == 1: potential_lira_partner = 210000 potential_comp_partner = Decimal(potential_lira_partner / 5000) * Decimal(0.25) self.player.lira_4_partner = potential_lira_partner self.player.potential_comp_4_partner = potential_comp_partner else: # Shared interest with other conversion rate # This is always Manager B hitting this page, so easy to know whose data to look at # Shared interest, have to split the slack - but leave the raw slack as-is if audit_4A == 0 and self.player.report_4A_partner > self.player.actual_4A: self.player.slack_4A = self.player.report_4A_partner - self.player.actual_4A self.player.slack_dol_4A = Decimal(self.player.slack_4A / 5000) * Decimal(0.50) else: self.player.slack_4A = 0 self.player.slack_dol_4A = 0.00 if audit_4B == 0 and self.player.report_4B > self.player.actual_4B: self.player.slack_4B = self.player.report_4B_partner - self.player.actual_4B self.player.slack_dol_4B = Decimal(self.player.slack_4B / 5000) * Decimal(0.50) else: self.player.slack_4B = 0 self.player.slack_dol_4B = 0.00 # Also need to update reporting outcomes, potential lira, and potential comp... if self.player.bust_4A == 1 or self.player.bust_4B == 1: potential_lira = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_4A == 0 and self.player.audit_flag_4B == 0: if self.player.slack_4B > 0: potential_lira = int(self.player.slack_4B / 2) + 15000 else: potential_lira = 15000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_4B == 1 and self.player.audit_flag_4A == 0: potential_lira = 60000 elif self.player.audit_flag_4A == 1 and self.player.audit_flag_4B == 0: # Could have slack if self.player.slack_4B > 0: potential_lira = int(self.player.slack_4B / 2) + 60000 else: potential_lira = 60000 elif self.player.audit_flag_4A == 1 and self.player.audit_flag_4B == 1: potential_lira = 105000 potential_comp = Decimal(potential_lira / 5000) * Decimal(0.50) self.player.lira_4 = potential_lira self.player.potential_comp_4 = potential_comp # Same for Manager A... if self.player.bust_4A_partner == 1 or self.player.bust_4B_partner == 1: potential_lira_partner = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_4A == 0 and self.player.audit_flag_4B == 0: if self.player.slack_4A > 0: potential_lira_partner = int(self.player.slack_4A / 2) + 15000 else: potential_lira_partner = 15000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_4A == 1 and self.player.audit_flag_4B == 0: potential_lira_partner = 60000 elif self.player.audit_flag_4B == 1 and self.player.audit_flag_4A == 0: # Could have slack if self.player.slack_4A > 0: potential_lira_partner = int(self.player.slack_4A / 2) + 60000 else: potential_lira_partner = 60000 elif self.player.audit_flag_4A == 1 and self.player.audit_flag_4B == 1: potential_lira_partner = 105000 potential_comp_partner = Decimal(potential_lira_partner / 5000) * Decimal(0.50) self.player.lira_4_partner = potential_lira_partner self.player.potential_comp_4_partner = potential_comp_partner if self.player.lira_4 == 0: self.player.slack_4B = 0 self.player.slack_dol_4B = 0.00 if self.player.lira_4_partner == 0: self.player.slack_4A = 0 self.player.slack_dol_4A = 0.00 # ...then update Manager A's stuff on the way out models.Player.objects.filter(participant_id=self.player.partner_id).update(audit_flag_4A=self.player.audit_flag_4A, audit_flag_4B=self.player.audit_flag_4B, slack_4A=self.player.slack_4A, slack_dol_4A=self.player.slack_dol_4A, slack_4B=self.player.slack_4B, slack_dol_4B=self.player.slack_dol_4B, bust_4A=self.player.bust_4A_partner, bust_4A_partner=self.player.bust_4A, bust_4B=self.player.bust_4B_partner, bust_4B_partner=self.player.bust_4B, lira_4=self.player.lira_4_partner, potential_comp_4=self.player.potential_comp_4_partner, lira_4_partner=self.player.lira_4, potential_comp_4_partner=self.player.potential_comp_4) class WaitReport4B(WaitPage): template_name = 'cost_reporting_task/CWaitPage2.html' body_text = "Please wait briefly while the other Manager makes their cost reports..." title_text = "" class Reporting_Results_4(Page): def vars_for_template(self): return {'slack_4A_share': int(self.player.slack_4A / 2), 'slack_4B_share': int(self.player.slack_4B / 2)} class Cost_Info_5(Page): form_model = models.Player form_fields = ['chat_time_5'] class Report5A(Page): form_model = models.Player form_fields = ['report_5A', 'report_5B'] def is_displayed(self): if self.player.type == 1: return True else: return False # Update partner's data def before_next_page(self): models.Player.objects.filter(participant_id=self.player.partner_id).update(report_5A_partner=self.player.report_5A, report_5B_partner=self.player.report_5B) class WaitReport5A(WaitPage): template_name = 'cost_reporting_task/CWaitPage2.html' body_text = "Please wait briefly while the other Manager makes their cost reports..." title_text = "" class Report5B(Page): form_model = models.Player form_fields = ['report_5A', 'report_5B'] def is_displayed(self): if self.player.type == 2: return True else: return False # Update partner's data def before_next_page(self): models.Player.objects.filter(participant_id=self.player.partner_id).update(report_5A_partner=self.player.report_5A, report_5B_partner=self.player.report_5B) # Can determine outcomes now that Manager B has reported, so do that before moving to results page # mgr_data = models.Player.objects.get(id=self.player.id) if self.player.report_5A != self.player.report_5A_partner: audit_5A = 1 else: audit_5A = 0 if self.player.report_5B != self.player.report_5B_partner: audit_5B = 1 else: audit_5B = 0 self.player.audit_flag_5A = audit_5A self.player.audit_flag_5B = audit_5B if audit_5A == 1 and self.player.report_5A != self.player.actual_5A: self.player.bust_5A = 1 else: self.player.bust_5A = 0 if audit_5B == 1 and self.player.report_5B != self.player.actual_5B: self.player.bust_5B = 1 else: self.player.bust_5B = 0 if audit_5A == 1 and self.player.report_5A_partner != self.player.actual_5A: self.player.bust_5A_partner = 1 else: self.player.bust_5A_partner = 0 if audit_5B == 1 and self.player.report_5B_partner != self.player.actual_5B: self.player.bust_5B_partner = 1 else: self.player.bust_5B_partner = 0 if self.player.condition == 7 or self.player.condition == 8: # No shared interest # This is always Manager B hitting this page, so easy to know whose data to look at if audit_5A == 0 and self.player.report_5A_partner > self.player.actual_5A: self.player.slack_5A = self.player.report_5A_partner - self.player.actual_5A self.player.slack_dol_5A = Decimal(self.player.slack_5A / 5000) * Decimal(0.25) else: self.player.slack_5A = 0 self.player.slack_dol_5A = 0.00 if audit_5B == 0 and self.player.report_5B > self.player.actual_5B: self.player.slack_5B = self.player.report_5B_partner - self.player.actual_5B self.player.slack_dol_5B = Decimal(self.player.slack_5B / 5000) * Decimal(0.25) else: self.player.slack_5B = 0 self.player.slack_dol_5B = 0.00 # Also need to update reporting outcomes, potential lira, and potential comp... if self.player.bust_5A == 1 or self.player.bust_5B == 1: potential_lira = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_5A == 0 and self.player.audit_flag_5B == 0: if self.player.slack_5B > 0: potential_lira = self.player.slack_5B + 30000 else: potential_lira = 30000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_5B == 1 and self.player.audit_flag_5A == 0: potential_lira = 120000 elif self.player.audit_flag_5A == 1 and self.player.audit_flag_5B == 0: # Could have slack if self.player.slack_5B > 0: potential_lira = self.player.slack_5B + 120000 else: potential_lira = 120000 elif self.player.audit_flag_5A == 1 and self.player.audit_flag_5B == 1: potential_lira = 210000 potential_comp = Decimal(potential_lira / 5000) * Decimal(0.25) self.player.lira_5 = potential_lira self.player.potential_comp_5 = potential_comp # Same for Manager A... if self.player.bust_5A_partner == 1 or self.player.bust_5B_partner == 1: potential_lira_partner = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_5A == 0 and self.player.audit_flag_5B == 0: if self.player.slack_5A > 0: potential_lira_partner = self.player.slack_5A + 30000 else: potential_lira_partner = 30000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_5A == 1 and self.player.audit_flag_5B == 0: potential_lira_partner = 120000 elif self.player.audit_flag_5B == 1 and self.player.audit_flag_5A == 0: # Could have slack if self.player.slack_5A > 0: potential_lira_partner = self.player.slack_5A + 120000 else: potential_lira_partner = 120000 elif self.player.audit_flag_5A == 1 and self.player.audit_flag_5B == 1: potential_lira_partner = 210000 potential_comp_partner = Decimal(potential_lira_partner / 5000) * Decimal(0.25) self.player.lira_5_partner = potential_lira_partner self.player.potential_comp_5_partner = potential_comp_partner else: # Shared interest with other conversion rate # This is always Manager B hitting this page, so easy to know whose data to look at # Shared interest, have to split the slack - but leave the raw slack as-is if audit_5A == 0 and self.player.report_5A_partner > self.player.actual_5A: self.player.slack_5A = self.player.report_5A_partner - self.player.actual_5A self.player.slack_dol_5A = Decimal(self.player.slack_5A / 5000) * Decimal(0.50) else: self.player.slack_5A = 0 self.player.slack_dol_5A = 0.00 if audit_5B == 0 and self.player.report_5B > self.player.actual_5B: self.player.slack_5B = self.player.report_5B_partner - self.player.actual_5B self.player.slack_dol_5B = Decimal(self.player.slack_5B / 5000) * Decimal(0.50) else: self.player.slack_5B = 0 self.player.slack_dol_5B = 0.00 # Also need to update reporting outcomes, potential lira, and potential comp... if self.player.bust_5A == 1 or self.player.bust_5B == 1: potential_lira = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_5A == 0 and self.player.audit_flag_5B == 0: if self.player.slack_5B > 0: potential_lira = int(self.player.slack_5B / 2) + 15000 else: potential_lira = 15000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_5B == 1 and self.player.audit_flag_5A == 0: potential_lira = 60000 elif self.player.audit_flag_5A == 1 and self.player.audit_flag_5B == 0: # Could have slack if self.player.slack_5B > 0: potential_lira = int(self.player.slack_5B / 2) + 60000 else: potential_lira = 60000 elif self.player.audit_flag_5A == 1 and self.player.audit_flag_5B == 1: potential_lira = 105000 potential_comp = Decimal(potential_lira / 5000) * Decimal(0.50) self.player.lira_5 = potential_lira self.player.potential_comp_5 = potential_comp # Same for Manager A... if self.player.bust_5A_partner == 1 or self.player.bust_5B_partner == 1: potential_lira_partner = 0 else: # If nothing is audited, they either got some slack plus salary or just salary if self.player.audit_flag_5A == 0 and self.player.audit_flag_5B == 0: if self.player.slack_5A > 0: potential_lira_partner = int(self.player.slack_5A / 2) + 15000 else: potential_lira_partner = 15000 # If only their project was audited (and they didn't get busted), they got an audit bonus/salary elif self.player.audit_flag_5A == 1 and self.player.audit_flag_5B == 0: potential_lira_partner = 60000 elif self.player.audit_flag_5B == 1 and self.player.audit_flag_5A == 0: # Could have slack if self.player.slack_5A > 0: potential_lira_partner = int(self.player.slack_5A / 2) + 60000 else: potential_lira_partner = 60000 elif self.player.audit_flag_5A == 1 and self.player.audit_flag_5B == 1: potential_lira_partner = 105000 potential_comp_partner = Decimal(potential_lira_partner / 5000) * Decimal(0.50) self.player.lira_5_partner = potential_lira_partner self.player.potential_comp_5_partner = potential_comp_partner if self.player.lira_5 == 0: self.player.slack_5B = 0 self.player.slack_dol_5B = 0.00 if self.player.lira_5_partner == 0: self.player.slack_5A = 0 self.player.slack_dol_5A = 0.00 # ...then update Manager A's stuff on the way out models.Player.objects.filter(participant_id=self.player.partner_id).update(audit_flag_5A=self.player.audit_flag_5A, audit_flag_5B=self.player.audit_flag_5B, slack_5A=self.player.slack_5A, slack_dol_5A=self.player.slack_dol_5A, slack_5B=self.player.slack_5B, slack_dol_5B=self.player.slack_dol_5B, bust_5A=self.player.bust_5A_partner, bust_5A_partner=self.player.bust_5A, bust_5B=self.player.bust_5B_partner, bust_5B_partner=self.player.bust_5B, lira_5=self.player.lira_5_partner, potential_comp_5=self.player.potential_comp_5_partner, lira_5_partner=self.player.lira_5, potential_comp_5_partner=self.player.potential_comp_5) class WaitReport5B(WaitPage): template_name = 'cost_reporting_task/CWaitPage2.html' body_text = "Please wait briefly while the other Manager makes their cost reports..." title_text = "" class Reporting_Results_5(Page): def vars_for_template(self): return {'slack_5A_share': int(self.player.slack_5A / 2), 'slack_5B_share': int(self.player.slack_5B / 2)} def before_next_page(self): pay_period = random.randint(1, 5) self.player.pay_period = pay_period if pay_period == 1: self.player.pay_period_lira = self.player.lira_1 elif pay_period == 2: self.player.pay_period_lira = self.player.lira_2 elif pay_period == 3: self.player.pay_period_lira = self.player.lira_3 elif pay_period == 4: self.player.pay_period_lira = self.player.lira_4 else: self.player.pay_period_lira = self.player.lira_5 if self.player.condition == 7 or self.player.condition == 8: comp_1 = Decimal(self.player.pay_period_lira / 5000) * Decimal(0.25) else: comp_1 = Decimal(self.player.pay_period_lira / 5000) * Decimal(0.50) self.player.comp_1 = '{0:.2f}'.format(round(comp_1, 2)) #Store pay period, pay period lira, and pay period $ comp in participant vars for use in part2 app self.participant.vars['pay_lira'] = self.player.pay_period_lira self.participant.vars['comp_1'] = self.player.comp_1 self.participant.vars['pay_period'] = self.player.pay_period page_sequence = [ GroupWait, Pre_Task, ChatWait, Cost_Info, Report1A, WaitReport1A, Report1B, WaitReport1B, Reporting_Results, ChatWait, Cost_Info_2, Report2A, WaitReport2A, Report2B, WaitReport2B, Reporting_Results_2, ChatWait, Cost_Info_3, Report3A, WaitReport3A, Report3B, WaitReport3B, Reporting_Results_3, ChatWait, Cost_Info_4, Report4A, WaitReport4A, Report4B, WaitReport4B, Reporting_Results_4, ChatWait, Cost_Info_5, Report5A, WaitReport5A, Report5B, WaitReport5B, Reporting_Results_5, ]