Testtemplate with questions loading now

This commit is contained in:
Jan 2024-05-30 17:54:28 +02:00
parent 6e6868e230
commit 01a8e5f021
3 changed files with 49 additions and 6 deletions

View File

@ -249,6 +249,7 @@ def jsonform():
stimulus_configuration = current_block["stimuli"]["configuration"] # dict with the config
if current_block["type"] == "TaskTemplate":
print("case: TaskTemplate")
match stimulus_type:
@ -260,7 +261,8 @@ def jsonform():
stimuli=current_block_stimuli,
stimulus_type=stimulus_type,
current_stimulus=current_stimulus,
stimulus_configuration=stimulus_configuration
stimulus_configuration=stimulus_configuration,
questions=current_block["questions"]
)

View File

@ -14,6 +14,43 @@
"configuration":{
"embed":"yt"
}
},
"questions":{
"question1":{
"type": "likert",
"name": "likertscale",
"points":{
"p1":{
"value":"1",
"text":"I dont like it at all"
},
"p2":{
"value":"2",
"text":"I dont like it at all"
},
"p3":{
"value":"3",
"text":"I dont like it at all"
},
"p4":{
"value":"4",
"text":"I dont like it at all"
},
"p5":{
"value":"5",
"text":"I dont like it at all"
}
}
}
},
"database_table" :{
"table_name": "default_block3_test",
"fields": {
"likertscale":{
"type": "integer",
"nullable": "false"
}
}
}
},
"Block_1":{

View File

@ -41,11 +41,15 @@
<h2>Questions</h2>
<form action="http://localhost:5000/send_json" method="post"></form>
<form action="http://localhost:5000/send_json" method="post">
{% for question in questions %}
{% if (questions[question] == "likert") %}
{% elif (config["question 1"]["blocks"][block]["type"] == "textinput") %}
{% if (questions[question]["type"] == "likert") %}
<div class="likert"></div>
{% for point in questions[question]["points"] %}
<label><input name="likertscale" type="radio" value="{{ questions[question]['points'][point]['value'] }}"/><span>{{ questions[question]['points'][point]['text'] }}</span></label>
{% endfor %}
</div>
{% elif (questions[question]["type"] == "textinput") %}
{% else %}
<p>Error: Block {{config["question 1"]["blocks"][block]["type"]}} could not be loaded!</p>
{% endif %}