diff --git a/slaeforms/app.py b/slaeforms/app.py index 1011057..66d7574 100644 --- a/slaeforms/app.py +++ b/slaeforms/app.py @@ -351,7 +351,7 @@ def sendpage_json(): # Now move to the next stimulus or block update_session() - + print("now redirect and reload the page") return redirect("/jsonform") def update_session(): diff --git a/slaeforms/default.json b/slaeforms/default.json index 1a4db5f..44db713 100644 --- a/slaeforms/default.json +++ b/slaeforms/default.json @@ -1,4 +1,78 @@ { + "Block 4":{ + "type": "TaskTemplate", + "tempalte": "standard_template.html", + "number_of_pages":"3", + "stimuli":{ + "type":"single_video", + "order": "random", + "list":{ + "video_1":"https://www.youtube-nocookie.com/embed/VtnwHmabyzo?si=H3rrG-GHtlSymR70", + "video_2":"https://www.youtube-nocookie.com/embed/EL76Ok4r0aQ?si=hqUm8eUUfX39NN4L", + "video_3":"https://www.youtube-nocookie.com/embed/XTMIomsXxKM?si=r2zB6OKERH6Jdpi6" + }, + "configuration":{ + "embed":"yt" + } + }, + "questions":{ + "question1":{ + "type": "likert", + "name": "likertscale", + "text": "How would you rate this video?", + "required": "true", + "points":{ + "p1":{ + "value":"1", + "text":"I dont like it at all" + }, + "p2":{ + "value":"2", + "text":"I dont like it" + }, + "p3":{ + "value":"3", + "text":"I am indifferent" + }, + "p4":{ + "value":"4", + "text":"I like it" + }, + "p5":{ + "value":"5", + "text":"I like it a lot" + } + } + }, + "question2":{ + "type": "textinput", + "name": "text_feedback", + "text": "Here you can give us Feedback", + "required": "false", + "size": "250" + }, + "question3":{ + "type": "videoinput", + "text": "Here you can give us Feedback as video", + "name": "video_feedback", + "required": "false" + } + }, + "database_table" :{ + "table_name": "default_block3_test", + "fields": { + "likertscale":{ + "type": "integer", + "nullable": "false" + }, + "text_feedback":{ + "type": "string", + "size": "250", + "nullable": "true" + } + } + } + }, "Block 3":{ "type": "TaskTemplate", "tempalte": "standard_template.html", @@ -135,80 +209,6 @@ } } }, - "Block 4":{ - "type": "TaskTemplate", - "tempalte": "standard_template.html", - "number_of_pages":"3", - "stimuli":{ - "type":"single_video", - "order": "random", - "list":{ - "video_1":"https://www.youtube-nocookie.com/embed/VtnwHmabyzo?si=H3rrG-GHtlSymR70", - "video_2":"https://www.youtube-nocookie.com/embed/EL76Ok4r0aQ?si=hqUm8eUUfX39NN4L", - "video_3":"https://www.youtube-nocookie.com/embed/XTMIomsXxKM?si=r2zB6OKERH6Jdpi6" - }, - "configuration":{ - "embed":"yt" - } - }, - "questions":{ - "question1":{ - "type": "likert", - "name": "likertscale", - "text": "How would you rate this video?", - "required": "true", - "points":{ - "p1":{ - "value":"1", - "text":"I dont like it at all" - }, - "p2":{ - "value":"2", - "text":"I dont like it" - }, - "p3":{ - "value":"3", - "text":"I am indifferent" - }, - "p4":{ - "value":"4", - "text":"I like it" - }, - "p5":{ - "value":"5", - "text":"I like it a lot" - } - } - }, - "question2":{ - "type": "textinput", - "name": "text_feedback", - "text": "Here you can give us Feedback", - "required": "false", - "size": "250" - }, - "question3":{ - "type": "videoinput", - "text": "Here you can give us Feedback as video", - "name": "video_feedback", - "required": "false" - } - }, - "database_table" :{ - "table_name": "default_block3_test", - "fields": { - "likertscale":{ - "type": "integer", - "nullable": "false" - }, - "text_feedback":{ - "type": "string", - "size": "250", - "nullable": "true" - } - } - } - }, "Block_1":{ "type": "SinglePage", "template": "test_page0.html" diff --git a/slaeforms/static/videoscript.js b/slaeforms/static/videoscript.js index 2e8e57a..49adb5d 100644 --- a/slaeforms/static/videoscript.js +++ b/slaeforms/static/videoscript.js @@ -35,16 +35,21 @@ document.getElementById("question_form").addEventListener("submit", function (ev fetch("/send_json", { method: "POST", body: formData + }).then(response => { + console.log('Response:', response); + // Check if response is a redirect (HTTP 3xx status) + if (response.redirected) { + console.log("Redirecting to:", response.url); + window.location.href = response.url; // Redirect to the new page + } else { + console.log("Non-redirect response received."); + // Handle other responses if needed + } }) - .then(response => response.json()) - .then(data => { - console.log('Success:', data); - // Handle success response - }) - .catch(error => { - console.error('Error:', error); - // Handle error response - }); + .catch(error => { + console.error('Error:', error); + // Handle errors if fetch fails + }); }); async function cameraButton() { diff --git a/slaeforms/uploads/a72f05bb-d6a7-4f0d-940d-e286746b015c_Block 4_video_2_2024.06.15 19-49-35.webm b/slaeforms/uploads/a72f05bb-d6a7-4f0d-940d-e286746b015c_Block 4_video_2_2024.06.15 19-49-35.webm new file mode 100644 index 0000000..6c77ad6 Binary files /dev/null and b/slaeforms/uploads/a72f05bb-d6a7-4f0d-940d-e286746b015c_Block 4_video_2_2024.06.15 19-49-35.webm differ diff --git a/slaeforms/uploads/acd47b24-2a64-400a-be52-258fa6dbfee3_Block 4_video_1_2024.06.15 19-15-06.webm b/slaeforms/uploads/acd47b24-2a64-400a-be52-258fa6dbfee3_Block 4_video_1_2024.06.15 19-15-06.webm new file mode 100644 index 0000000..fff3622 Binary files /dev/null and b/slaeforms/uploads/acd47b24-2a64-400a-be52-258fa6dbfee3_Block 4_video_1_2024.06.15 19-15-06.webm differ diff --git a/slaeforms/uploads/adffef3d-4d54-4a4d-8230-ec1ef2ede482_Block 4_video_3_2024.06.15 19-25-08.webm b/slaeforms/uploads/adffef3d-4d54-4a4d-8230-ec1ef2ede482_Block 4_video_3_2024.06.15 19-25-08.webm new file mode 100644 index 0000000..a1f87f6 Binary files /dev/null and b/slaeforms/uploads/adffef3d-4d54-4a4d-8230-ec1ef2ede482_Block 4_video_3_2024.06.15 19-25-08.webm differ