from ._builtin import Page, WaitPage # from otree.api import Currency as c, currency_range from .models import Constants from django.template.defaulttags import register import random @register.filter def get_choices(choice_history, round_num): return choice_history[round_num-1] class RoundSurvey(Page): def vars_for_template(self): round_in_session = len(self.participant.vars['all_my_decisions']) return { 'lastRound': True, 'results': True, 'RoundSurvey': True, 'num_rounds': Constants.num_rounds, # 'all_my_decisions': [p.decision for p in me.in_all_rounds()], 'all_my_decisions': self.participant.vars['all_my_decisions'], 'all_bot_decisions': self.participant.vars['all_bot_decisions'], 'all_my_payoffs': self.participant.vars['all_my_payoffs'], 'all_bot_payoffs': self.participant.vars['all_bot_payoffs'], 'my_total_payoff': sum(self.participant.vars['all_my_payoffs']), 'bot_total_payoff': sum(self.participant.vars['all_bot_payoffs']), 'round_curr': self.round_number, 'round_nums': range(1, round_in_session+1), # 'round_nums': range(1, self.round_number+1), 'rounds_per_session': Constants.rounds_per_session, 'round_in_session': round_in_session, 'session_curr': 3, 'all_my_total_payoffs': self.participant.vars['all_my_total_payoffs'], 'all_bot_total_payoffs': self.participant.vars['all_bot_total_payoffs'], } form_model = 'player' form_fields = ['guess_strategy'] page_sequence = [ RoundSurvey ]