from otree.api import (
    models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer,
    Currency as c, currency_range
)


author = 'Your name here'

doc = """
Your app description
"""


class Constants(BaseConstants):
    name_in_url = 'nuitdudroit2018_risque'
    players_per_group = None
    num_rounds = 1


class Subsession(BaseSubsession):
    def vars_for_admin_report(self):
        all_players_app_page = [(str(self.id) + str(p.participant._current_page_name))
                                for p in self.get_players()]
        nb_players_per_page_list =\
            [(PageClass.__name__, all_players_app_page.count((str(self.id) + str(PageClass.__name__))))
             for PageClass in pages.page_sequence]
        return {
            'nb_players_per_page_list': nb_players_per_page_list,
        }


class Group(BaseGroup):
    pass


class Player(BasePlayer):
    choix1V2P_risque = models.IntegerField(choices=[0, 1, 2], initial=0)
    choix1V3P_risque = models.IntegerField(choices=[0, 1, 2], initial=0)
    choix1V4P_risque = models.IntegerField(choices=[0, 1, 2], initial=0)


from . import pages
