multiple choice implemented + Dem Quest implemented

This commit is contained in:
Jan 2024-09-05 16:36:44 +02:00
parent 73127d9950
commit cdbb57d50d
7 changed files with 240 additions and 58 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@ __pycache__/
instance/
uploads/
zip_exports/
.pytest_cache/
.coverage

View File

@ -42,8 +42,8 @@ app.secret_key = b"29fe9e8edd407c5491d4f1c05632d9fa33e26ed8734a3f5e080ebac3772a5
UPLOAD_FOLDER = 'uploads'
EXPORT_FOLDER = 'exports'
PASSWORD = '#1ACGmsjd'
# CONFIGFILE = 'userstudy1.json'
CONFIGFILE = 'test.json'
CONFIGFILE = 'userstudy1.json'
# CONFIGFILE = 'test.json'
# CONFIGFILE = 'default.json'
#csrf = CSRFProtect(app) #enable CSRF protection globally
@ -364,7 +364,19 @@ def sendpage():
setattr(new_entry, "video_upload", video_name)
for key, value in request.form.items():
# TODO maybe find a prettier solution, this handeles multiple choice now, so the fact that there can be
# multiple keys that are the same in the form data, but I want to bring them together to 1 key value pair
form_data = {}
for key in request.form:
values = request.form.getlist(key)
# If there's more than one value for the key, join them with commas
if len(values) > 1:
form_data[key] = ','.join(map(str, values)) # Join multiple values into a single comma-separated string
else:
form_data[key] = values[0] # If only one value, store it directly
for key, value in form_data.items():
print("hasattr key: ", key)
if hasattr(new_entry, key):
print("key exists: ", key)

View File

@ -118,9 +118,7 @@ label {
margin-bottom: 1.5rem;
}
input,
textarea,
select {
.inputs {
margin: 10px 0 0 0;
width: 60%;
min-height: 2em;

View File

@ -73,7 +73,7 @@ step={{question["step"]}}
{% macro input(name, value='', type='text', size=20) -%}
<input type="{{ type }}" name="{{ name }}" value="{{
value|e }}" size="{{ size }}">
value|e }}" size="{{ size }}" class="inputs">
{%- endmacro %}
<head>
@ -132,7 +132,7 @@ step={{question["step"]}}
<div class="likert" style="--likert-rows: {{ questions[question]['points']|length() }}">
{% for point in questions[question]["points"] %}
<label>
<input name="{{ questions[question]['name']}}" type="radio"
<input class="inputs" name="{{ questions[question]['name']}}" type="radio"
id="{{ questions[question]['name'] }}"
value="{{ questions[question]['points'][point]['value'] }}"
{{required(questions[question])}} /><span>{{ questions[question]['points'][point]['text']
@ -145,7 +145,7 @@ step={{question["step"]}}
<div class="textarea-container">
<label class="textarea-label">
{{ questions[question]['text']}}
<textarea id="{{ questions[question]['name'] }}" name="{{ questions[question]['name'] }}" rows="6"
<textarea class="inputs" id="{{ questions[question]['name'] }}" name="{{ questions[question]['name'] }}" rows="6"
cols="60" maxlength="{{ questions[question]['size'] }}"
{{required(questions[question])}}></textarea>
</label>
@ -154,14 +154,14 @@ step={{question["step"]}}
{% elif (questions[question]["type"] == "dateinput") %}
<div class="compressWidth">
<label>
{{ questions[question]['text']}}<input type="date" name="{{ questions[question]['name']}}"
{{ questions[question]['text']}}<input class="inputs" type="date" name="{{ questions[question]['name']}}"
id="{{ questions[question]['name'] }}" {{required(questions[question])}}>
</label>
</div>
{% elif (questions[question]["type"] == "numberinput") %}
<div class="compressWidth">
<label>
{{ questions[question]['text']}}<input type="number" name="{{ questions[question]['name']}}"
{{ questions[question]['text']}}<input class="inputs" type="number" name="{{ questions[question]['name']}}"
id="{{ questions[question]['name'] }}" {{inputconfig(questions[question])}}
{{required(questions[question])}}>
</label>
@ -170,7 +170,7 @@ step={{question["step"]}}
{% elif (questions[question]["type"] == "emailinput") %}
<div class="compressWidth">
<label>
{{ questions[question]['text']}}<input type="email" name="{{ questions[question]['name']}}"
{{ questions[question]['text']}}<input class="inputs" type="email" name="{{ questions[question]['name']}}"
id="{{ questions[question]['name'] }}" {{required(questions[question])}}>
</label>
</div>
@ -178,7 +178,7 @@ step={{question["step"]}}
{% elif (questions[question]["type"] == "dropdowninput") %}
<div class="compressWidth">
<label>
{{ questions[question]['text']}}<select name="{{ questions[question]['name']}}"
{{ questions[question]['text']}}<select class="inputs" name="{{ questions[question]['name']}}"
{{required(questions[question])}}>
<option value="" disabled selected>{{ questions[question]['defaulttext']}}</option>
{% for point in questions[question]["points"] %}
@ -192,6 +192,20 @@ step={{question["step"]}}
</label>
</div>
{% elif (questions[question]["type"] == "multiplechoice") %}
<div class="compressWidth">
<label>
{{ questions[question]['text']}}
{% for point in questions[question]["points"] %}
<label for="{{ point }}">
<input type="checkbox" id="{{ point }}" name="{{ questions[question]['name'] }}" value="{{ questions[question]['points'][point]['value'] }}">
{{ questions[question]['points'][point]['text']}}</label>
{% endfor %}
</label>
</div>
{% elif (questions[question]["type"] == "videoinput") %}
<div class="spacer" aria-hidden="true" style="height:30px"></div>
<h3>{{ questions[question]['text']}}</h3>
@ -231,7 +245,7 @@ step={{question["step"]}}
{% endif %}
{% endfor %}
<div class="button-container">
<input id="submitbutton" type="submit" value="submit" />
<input class="inputs" id="submitbutton" type="submit" value="submit" />
<!-- TODO maybe I want to use this instead: <button id="submitbutton" type="submit">Submit</button> -->
</div>
</form>

View File

@ -12,7 +12,7 @@
"question1_alter": {
"type": "numberinput",
"name": "alter",
"text": "Alter:",
"text": "Wie alt sind sie?",
"required": "true",
"min": "1",
"max": "120"
@ -20,7 +20,7 @@
"question2_geschlecht": {
"type": "dropdowninput",
"name": "geschlecht",
"text": "Geschlecht:",
"text": "Wie ist ihr Geschlecht?",
"required": "true",
"defaulttext": "",
"points": {
@ -42,64 +42,196 @@
}
}
},
"question3_hoerstatus": {
"question3_bildung": {
"type": "dropdowninput",
"name": "hoerstatus",
"text": "Hörstatus:",
"name": "bildung",
"text": "Was ist ihr höchster Bildungsabschluss?",
"required": "true",
"defaulttext": "",
"points": {
"hörend": {
"value": "Hörend",
"text": "Hörend"
"keiner": {
"value": "Keiner",
"text": "Keiner"
},
"hauptschule": {
"value": "Hauptschule",
"text": "Hauptschule"
},
"realschule": {
"value": "Realschule",
"text": "Realschule"
},
"ausbildung": {
"value": "Ausbildung",
"text": "Abgeschlossene Ausbildung"
},
"abitur": {
"value": "Abitur",
"text": "Abitur "
},
"fachhochschulreife": {
"value": "Fachhochschulreife",
"text": "Fachhochschulreife"
},
"bachelor": {
"value": "Bachelor",
"text": "Bachelor"
},
"master": {
"value": "Master",
"text": "Master"
},
"diplom": {
"value": "Diplom",
"text": "Diplom"
},
"magister": {
"value": "Magister",
"text": "Magister"
},
"promotion": {
"value": "Promotion",
"text": "Promotion"
}
}
},
"question4_hoerstatus": {
"type": "dropdowninput",
"name": "hoerstatus",
"text": "Wie ist ihr Hörstatus?",
"required": "true",
"defaulttext": "",
"points": {
"gehörlos": {
"value": "Gehörlos",
"text": "Gehörlos/Taub"
},
"schwerhörig": {
"value": "Schwerhörig",
"text": "Schwerhörig"
},
"gehörlos": {
"value": "Gehörlos",
"text": "Gehörlos"
"gehörlosCI": {
"value": "GehörlosCI",
"text": "Gehörlos mit Cochlea-Implantat"
},
"hörend": {
"value": "Hörend",
"text": "Hörend"
}
}
},
"question4_bevorzugte_kommunikation": {
"question5_wann_gehörlos": {
"type": "numberinput",
"name": "wann_gehörlos",
"text": "In welchem Alter wurden sie gehörlos/schwerhörig? (\"0\" für ab Geburt, \"-1\" falls sie hören können)",
"required": "true",
"min": "-1",
"max": "120"
},
"question6_wann_gebärdensprache": {
"type": "numberinput",
"name": "wann_gebärdensprache",
"text": "Seit welchem Alter lernen sie Gebärdensprache?",
"required": "true",
"min": "0",
"max": "120"
},
"question7_eltern_gehörlos": {
"type": "dropdowninput",
"name": "bevorzugte_kommunikation",
"text": "Bevorzugte Kommunikationsform:",
"name": "eltern_gehörlos",
"text": "Sind ihre Eltern Gehörlos?",
"required": "true",
"defaulttext": "",
"points": {
"gesprochen": {
"value": "Gesprochene Sprache",
"text": "Gesprochene Sprache"
"einer": {
"value": "einer",
"text": "Ein Elternteil"
},
"text": {
"value": "Text",
"text": "Text"
"beide": {
"value": "beide",
"text": "Beide"
},
"keiner": {
"value": "keiner",
"text": "Nein"
}
}
},
"question8_zuhause_sl": {
"type": "multiplechoice",
"name": "zuhause_sl",
"text": "Welche Sprache(n) verwenden sie zuhause?",
"required": "true",
"defaulttext": "",
"points": {
"deutsch": {
"value": "Deutsch",
"text": "Deutsch"
},
"gebärdensprache": {
"value": "Gebärdensprache",
"text": "Gebärdensprache"
},
"sonstige": {
"value": "Sonstige",
"text": "Sonstige"
}
}
},
"question5_gebeardenzeitraum": {
"type": "numberinput",
"name": "gebärdenzeitraum",
"text": "Wie viele Jahre verwenden sie schon Gebärdensprache:",
"question9_arbeit_sl": {
"type": "multiplechoice",
"name": "arbeit_sl",
"text": "Welche Sprache(n) verwenden sie auf der Arbeit/in der Schule?",
"required": "true",
"min": "0",
"max": "100",
"step": "0.5"
"defaulttext": "",
"points": {
"deutsch": {
"value": "Deutsch",
"text": "Deutsch"
},
"gebärdensprache": {
"value": "Gebärdensprache",
"text": "Gebärdensprache"
},
"sonstige": {
"value": "Sonstige",
"text": "Sonstige"
}
}
},
"question6_sprachkompetenz": {
"type": "numberinput",
"name": "gebärdensprachkompetenz",
"text": "Wie schätzen sie ihre Gebärdensprachkompetenz ein (1-10):",
"question10_schule": {
"type": "dropdowninput",
"name": "schule",
"text": "Haben sie eine Förderschule für Gehörlose und Schwerhörige besucht?",
"required": "true",
"min": "1",
"max": "10"
"defaulttext": "",
"points": {
"ja": {
"value": "Ja",
"text": "Ja"
},
"Nein": {
"value": "Nein",
"text": "Nein"
}
}
},
"question11_avatar_erfahrung": {
"type": "dropdowninput",
"name": "avatar_erfahrung",
"text": "Haben sie schonmal Computeranimationen von Gebärdensprache gesehen? (Gebärdenavatare)",
"required": "true",
"defaulttext": "",
"points": {
"ja": {
"value": "Ja",
"text": "Ja"
},
"Nein": {
"value": "Nein",
"text": "Nein"
}
}
}
},
"infovideo": {
@ -121,22 +253,47 @@
"size": "14",
"nullable": "false"
},
"bildung": {
"type": "string",
"size": "30",
"nullable": "false"
},
"hoerstatus": {
"type": "string",
"size": "14",
"size": "35",
"nullable": "false"
},
"bevorzugte_kommunikation": {
"wann_gehörlos": {
"type": "int",
"nullable": "false"
},
"wann_gebärdensprache": {
"type": "int",
"nullable": "false"
},
"eltern_gehörlos": {
"type": "string",
"size": "22",
"size": "6",
"nullable": "false"
},
"gebärdenzeitraum": {
"type": "float",
"zuhause_sl": {
"type": "string",
"size": "40",
"nullable": "false"
},
"gebärdensprachkompetenz": {
"type": "integer",
"arbeit_sl": {
"type": "string",
"size": "40",
"nullable": "false"
},
"schule": {
"type": "string",
"size": "4",
"nullable": "false"
},
"avatar_erfahrung": {
"type": "string",
"size": "4",
"nullable": "false"
}
}
@ -236,12 +393,12 @@
"stimuli": {
"type": "double_video",
"list_1": {
"video_1": "https://www.youtube-nocookie.com/embed/IqGVT1q1PtM?si=kel7ZWEQl3h-h522",
"video_2": "https://www.youtube-nocookie.com/embed/g9KA72jN5SM?si=O7dfqTXdFCCAScJ-"
"video_1": "https://www.youtube-nocookie.com/embed/pQCfrTyC-1s?si=-4nATwbeQ_U4wbDg",
"video_2": "https://www.youtube-nocookie.com/embed/pQCfrTyC-1s?si=-4nATwbeQ_U4wbDg"
},
"list_2": {
"video_2": "https://www.youtube-nocookie.com/embed/g9KA72jN5SM?si=O7dfqTXdFCCAScJ-",
"video_1": "https://www.youtube-nocookie.com/embed/IqGVT1q1PtM?si=kel7ZWEQl3h-h522"
"video_2": "https://www.youtube-nocookie.com/embed/trUewX8XBO4?si=14Q4s2Pn2M3ENPNd",
"video_1": "https://www.youtube-nocookie.com/embed/trUewX8XBO4?si=14Q4s2Pn2M3ENPNd"
},
"configuration": {
"embed": "yt"

Binary file not shown.

Binary file not shown.