Ejemplo n.º 1
0
 def get(self, category):
     if category == "kwartetvraag":
         r = random.randint(1, 52)
         qrCode = QRCode.query(QRCode.nr == r).get()
         template = jinja_environment.get_template("quiz.html")
         self.response.out.write(
             template.render(category="Kwartetvraag", vraag=qrCode.vraag, antwoord=qrCode.antwoord)
         )
     elif category == "catechismus1":
         (l, i) = randomInTwoRanges(22, 27)
         mc = MC.query(MC.l == l, MC.i == i).get()
         template = jinja_environment.get_template("quiz.html")
         self.response.out.write(
             template.render(category="Vraag uit de catechismus (1-2)", vraag=mc.q, antwoord=mc.a)
         )
     elif category == "catechismus2":
         (l, i) = randomInTwoRanges(76, 86)
         mc = MC.query(MC.l == l + 2, MC.i == i).get()
         template = jinja_environment.get_template("quiz.html")
         self.response.out.write(
             template.render(category="Vraag uit de catechismus (3-4)", vraag=mc.q, antwoord=mc.a)
         )
     elif category == "catechismus3":
         (l, i) = randomInThreeRanges(99, 70, 67)
         mc = MC.query(MC.l == l + 4, MC.i == i).get()
         template = jinja_environment.get_template("quiz.html")
         self.response.out.write(
             template.render(category="Vraag uit de catechismus (5-7)", vraag=mc.q, antwoord=mc.a)
         )
Ejemplo n.º 2
0
 def get(self):
     nrc = self.request.get("nr")
     qrCode = QRCode.get_by_id(nrc)
     template = jinja_environment.get_template("playing-card.html")
     if self.request.cookies.get("spelen") or self.request.get("spelen"):
         # use the URL option ?spelen=0.5 to force playing mode with predefined r
         if not self.request.get("spelen"):
             r = random.random()
         else:
             r = float(self.request.get("spelen"))
         if r < 0.1:
             # give the first other card in the set
             otherQrCode = (QRCode.query(QRCode.kwartetsluggy == qrCode.kwartetsluggy).fetch(3))[0]
             self.response.out.write(template.render(qrCode=otherQrCode))
         elif r < 0.2:
             # give the second other card in the set
             otherQrCode = (QRCode.query(QRCode.kwartetsluggy == qrCode.kwartetsluggy).fetch(3))[1]
             self.response.out.write(template.render(qrCode=otherQrCode))
         elif r < 0.3:
             # give the third other card in the set
             otherQrCode = (QRCode.query(QRCode.kwartetsluggy == qrCode.kwartetsluggy).fetch(3))[2]
             self.response.out.write(template.render(qrCode=otherQrCode))
         elif r < 0.6:
             # rechtvaardige god
             otherQrCode = QRCode.query(
                 QRCode.kwartetsluggy == "godsbeelden", QRCode.kaartsluggy == "rechtvaardige-god"
             ).get()
             self.response.out.write(template.render(qrCode=otherQrCode, quiz=True))
         elif r < 0.65:
             # toornige god
             otherQrCode = QRCode.query(
                 QRCode.kwartetsluggy == "godsbeelden", QRCode.kaartsluggy == "toornige-god"
             ).get()
             self.response.out.write(template.render(qrCode=otherQrCode))
         elif r < 0.8:
             # liefdevolle god
             otherQrCode = QRCode.query(
                 QRCode.kwartetsluggy == "godsbeelden", QRCode.kaartsluggy == "liefdevolle-god"
             ).get()
             self.response.out.write(template.render(qrCode=otherQrCode))
         elif r < 0.9:
             # almachtige god
             otherQrCode = QRCode.query(
                 QRCode.kwartetsluggy == "godsbeelden", QRCode.kaartsluggy == "almachtige-god"
             ).get()
             self.response.out.write(template.render(qrCode=otherQrCode))
         else:
             # barmhartige god
             otherQrCode = QRCode.query(
                 QRCode.kwartetsluggy == "godsbeelden", QRCode.kaartsluggy == "barmhartige-god"
             ).get()
             self.response.out.write(template.render(qrCode=otherQrCode))
     else:
         template = jinja_environment.get_template("card.html")
         self.response.out.write(template.render(qrCode=qrCode))
Ejemplo n.º 3
0
 def get(self):
     nrc = self.request.get('nr')
     qrCode = QRCode.get_by_id(nrc)
     template = jinja_environment.get_template('playing-card.html')
     if self.request.cookies.get('spelen') or self.request.get('spelen'):
         # use the URL option ?spelen=0.5 to force playing mode with predefined r
         if not self.request.get('spelen'):
             r = random.random()
         else:
             r = float(self.request.get('spelen'))
         if r < 0.1:
             # give the first other card in the set
             otherQrCode = (QRCode.query(QRCode.kwartetsluggy == qrCode.kwartetsluggy).fetch(3))[0]
             self.response.out.write(template.render(qrCode=otherQrCode))
         elif r < 0.2:
             # give the second other card in the set
             otherQrCode = (QRCode.query(QRCode.kwartetsluggy == qrCode.kwartetsluggy).fetch(3))[1]
             self.response.out.write(template.render(qrCode=otherQrCode))
         elif r < 0.3:
             # give the third other card in the set
             otherQrCode = (QRCode.query(QRCode.kwartetsluggy == qrCode.kwartetsluggy).fetch(3))[2]
             self.response.out.write(template.render(qrCode=otherQrCode))
         elif r < 0.6:
             # rechtvaardige god
             otherQrCode = QRCode.query(QRCode.kwartetsluggy == 'godsbeelden', QRCode.kaartsluggy == 'rechtvaardige-god').get()
             self.response.out.write(template.render(qrCode=otherQrCode, quiz=True))
         elif r < 0.65:
             # toornige god
             otherQrCode = QRCode.query(QRCode.kwartetsluggy == 'godsbeelden', QRCode.kaartsluggy == 'toornige-god').get()
             self.response.out.write(template.render(qrCode=otherQrCode))
         elif r < 0.8:
             # liefdevolle god
             otherQrCode = QRCode.query(QRCode.kwartetsluggy == 'godsbeelden', QRCode.kaartsluggy == 'liefdevolle-god').get()
             self.response.out.write(template.render(qrCode=otherQrCode))
         elif r < 0.9:
             # almachtige god
             otherQrCode = QRCode.query(QRCode.kwartetsluggy == 'godsbeelden', QRCode.kaartsluggy == 'almachtige-god').get()
             self.response.out.write(template.render(qrCode=otherQrCode))
         else:
             # barmhartige god
             otherQrCode = QRCode.query(QRCode.kwartetsluggy == 'godsbeelden', QRCode.kaartsluggy == 'barmhartige-god').get()
             self.response.out.write(template.render(qrCode=otherQrCode))
     else:
         template = jinja_environment.get_template('card.html')
         self.response.out.write(template.render(qrCode=qrCode))
Ejemplo n.º 4
0
 def get(self, category):
     if category == 'kwartetvraag':
         r = random.randint(1,52)
         qrCode = QRCode.query(QRCode.nr == r).get()
         template = jinja_environment.get_template('quiz.html')
         self.response.out.write(template.render(category='Kwartetvraag', vraag=qrCode.vraag, antwoord=qrCode.antwoord))
     elif category == 'catechismus1':
         (l, i) = randomInTwoRanges(22, 27)
         mc = MC.query(MC.l == l, MC.i == i).get()
         template = jinja_environment.get_template('quiz.html')
         self.response.out.write(template.render(category='Vraag uit de catechismus (1-2)', vraag=mc.q, antwoord=mc.a))
     elif category == 'catechismus2':
         (l, i) = randomInTwoRanges(76, 86)
         mc = MC.query(MC.l == l + 2, MC.i == i).get()
         template = jinja_environment.get_template('quiz.html')
         self.response.out.write(template.render(category='Vraag uit de catechismus (3-4)', vraag=mc.q, antwoord=mc.a))
     elif category == 'catechismus3':
         (l, i) = randomInThreeRanges(99, 70, 67)
         mc = MC.query(MC.l == l + 4, MC.i == i).get()
         template = jinja_environment.get_template('quiz.html')
         self.response.out.write(template.render(category='Vraag uit de catechismus (5-7)', vraag=mc.q, antwoord=mc.a))
Ejemplo n.º 5
0
 def get(self, set, card):
     qrCode = QRCode.query(QRCode.kwartetsluggy == set, QRCode.kaartsluggy == card).get()
     template = jinja_environment.get_template("card.html")
     self.response.out.write(template.render(qrCode=qrCode))
Ejemplo n.º 6
0
 def get(self, set, card):
     qrCode = QRCode.query(QRCode.kwartetsluggy == set, QRCode.kaartsluggy == card).get()
     template = jinja_environment.get_template('card.html')
     self.response.out.write(template.render(qrCode=qrCode))