from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants from django.http import HttpResponseRedirect def my_view(request): if Constants.decision == 0: return HttpResponseRedirect('https://app.prolific.co/submissions/complete?cc=71A2AA74') class ResultsWaitPage(WaitPage): group_by_arrival_time = True body_text = "Waiting for other participants to complete the study. or you can go the the link below to get your finish code." \ "https://app.prolific.co/submissions/complete?cc=71A2AA74" class Results(Page): def vars_for_template(self) -> dict: rounds, work, num_others, is_infected, payoffs, ids = self.player.set_payoff() self.player.set_initial_value() payoffs_real_currency = [c(payoff).to_real_world_currency(self.session) for payoff in payoffs] self.player.set_participant_payoff() for i in range(len(rounds)): self.player.round_selected += 'Round ' + str(rounds[i]) + ',' self.player.work_choices += 'Work,' if work[i] else 'Stay at home,' if work[i]: if is_infected[i]: self.player.infection += 'Infected,' else: self.player.infection += 'Not infected,' else: self.player.infection += 'N/A,' self.player.payoffs_selected += str(payoffs[i]) + ',' self.player.matched_other_id += str(ids[i]) + ',' return dict( no=[i + 1 for i in range(4)], rounds=rounds, work=work, num_others=num_others, is_infected=is_infected, payoffs=payoffs, payoffs_r=payoffs_real_currency, show_up=self.session.config['prolific_flat'], bonus_account_total= c(self.session.config['flat']) + self.player.payoff + c(self.participant.vars['questionnaire_risk']) + self.participant.vars['questionnaire_prob'], questionnaire_risk=self.participant.vars['questionnaire_risk'], questionnaire_prob=self.participant.vars['questionnaire_prob'], flat=c(self.session.config['flat']), total=c(self.session.config['prolific_flat'] * 100).to_real_world_currency(self.session) + self.participant.payoff_plus_participation_fee() ) from django.http import HttpResponseRedirect def post(request): return HttpResponseRedirect('https://app.prolific.co/submissions/complete?cc=71A2AA74') page_sequence = [ ResultsWaitPage, Results ]