def vars_for_template(self): results = Participant.get_payment_two_results(self.player) context = { 'player_id': results.player_id, 'other_id': results.other_player_id, 'cutoff_auction': results.auction, 'cutoff': results.cutoff, 'random_offer': round(results.random_offer, 2), 'offer_accepted': results.offer_accepted, } if not results.offer_accepted: if results.random_signal_is_percentage: random_signal = round(results.random_signal * 100, 2) else: random_signal = int(results.random_signal) if results.other_random_signal_is_percentage: others_random_signal = round(results.other_random_signal * 100, 2) else: others_random_signal = int(results.other_random_signal) context.update({ 'auction': results.auction, 'bid': results.bid, 'others_bid': results.other_bid, 'winner': results.lottery_won, 'signal': random_signal, 'others_signal': others_random_signal, 'signal_is_percentage': results.random_signal_is_percentage, 'others_signal_is_percentage': results.other_random_signal_is_percentage, 'low_value': results.low_value, 'high_value': results.high_value, 'low_prob': results.low_prob * 100, 'high_prob': results.high_prob * 100, 'high_chosen': results.high_prize_chosen, 'earnings': results.earnings, 'realized': results.realized, 'auction_type': results.auction.atype, 'low_prize_chosen': results.low_prize_chosen, 'high_prize_chosen': results.high_prize_chosen, }) return context
def vars_for_template(self): experiment = Participant.get_experiment(self.player) method_one = Participant.get_payment_one_results(self.player) method_two = Participant.get_payment_two_results(self.player) method_three = Participant.get_payment_three_results(self.player) part_one_earnings = method_one.earnings + method_two.earnings part_one_payoff = experiment.PART_ONE_WEIGHT * part_one_earnings * experiment.CONVERSION_RATE part_two_payoff = experiment.PART_TWO_WEIGHT * method_three.earnings * experiment.CONVERSION_RATE final_payoff = experiment.SHOW_UP_FEE + experiment.ENDOWMENT + part_one_payoff + part_two_payoff return { 'show_up_fee': experiment.SHOW_UP_FEE, 'endowment': experiment.ENDOWMENT, 'rate': experiment.CONVERSION_RATE, 'method_1': round(method_one.earnings, 2), 'method_2': round(method_two.earnings, 2), 'method_3': round(method_three.earnings, 2), 'total_in_credits': round(part_one_earnings, 2), 'earnings_1': round(part_one_payoff, 2), 'earnings_2': round(part_two_payoff, 2), 'final_payoff': round(final_payoff, 2), }