def vars_for_template(self): results = Participant.get_payment_three_results(self.player) context = { 'rolled_side': results.rolled_side, 'rolled_side_encoded': results.rolled_side_encoded, 'die_encoding': results.die_encoding, 'bet_color': Lottery.BET_HIGH_RED if results.bet_color == Lottery.BET_HIGH_RED else Lottery.BET_HIGH_BLUE, 'bet_high_red': Lottery.BET_HIGH_RED, 'bet_high_blue': Lottery.BET_HIGH_BLUE, 'high_value': results.high_value, 'low_value': results.low_value, 'lottery': results.lottery, 'lottery_type': results.lottery.ltype, 'cutoff': results.cutoff, 'random_cutoff': results.random_cutoff, 'play_lottery': results.play_lottery, 'num_red': results.num_red, 'num_blue': results.num_blue, 'realized_value': results.realized_value, 'earnings': results.earnings } 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), }