{# Assignement in if clause breaks test, we need to declare variables in global scope first: https://github.com/pallets/jinja/issues/1314 #} {% set random_question_id = -1 %} {% set random_answer_id = -1 %} {% set selected_question = "" %} {% set selected_answer = "" %} {% if annotations.type[0] == "multipleQAs" %} {% set random_question_id = range(0, annotations.qaPairs[0].question | length) | choice%} {% set random_answer_id = range(0, annotations.qaPairs[0].answer | length) | choice%} {% set selected_question = annotations.qaPairs[0].question[random_question_id] %} {% set selected_answer = annotations.qaPairs[0].answer[random_answer_id] | choice%} {% else %} {% set random_question_id = 0 %} {% set random_answer_id = 0 %} {% set selected_question = question %} {% set selected_answer = annotations.answer[0] | choice %} {% endif %} Is "{{selected_answer}}" an acceptable answer to "{{selected_question}}"? {{answer_choices[0]}} or {{answer_choices[1].lower()}}?
Pensando...
