Demo Comprehension test simple version

170 views
Skip to first unread message

que...@gmail.com

unread,
Oct 11, 2021, 11:16:39 AM10/11/21
to oTree help & discussion
Hello,

I would like to use this code on this page : https://otree-snippets.herokuapp.com/demo
It is about comprehension test (simple version).
I try with your code but I have to adapt it because I have a page models.py et pages.py
and in your code you put all in the same file  : init.py

My error is in pages.py
class Quizzi(Page):
form_model = 'player'
form_fields = ['quiz1','quiz2','quiz3','quiz4']

@staticmethod
def error_message(player: Player, values):  
  => in Quizz def error_message(player : Player,values):
solutions = dict(quizNonVOI1=1, quizNonVOI2=1, quizNonVOI3=1)

if values != solutions:
return "One or more answers were incorrect."

Think you for your help.
QC

Reply all
Reply to author
Forward
0 new messages