# Definition of views/pages for the survey. # Please note: When using oTree 2.x, this file should be called "pages.py" instead of "views.py" # from otree.api import Currency as c, currency_range from . import models from ._builtin import Page, WaitPage from .models import Constants from otreeutils.surveys import SurveyPage, setup_survey_pages import time class Decision(Page): form_model = 'player' form_fields = ['guess'] live_method = 'live_method' def js_vars(self): return dict( answered = self.player.answered, ) def vars_for_template(self): anchor = self.player.anchor if anchor <1000: price_low = anchor price_high = round(anchor*1.5) else: price_high = anchor price_low = round(anchor*0.8) return { 'price_low': price_low, 'price_high': price_high, } page_sequence = [ Decision, ]