Merge branch '115-fehler-eingabe-funktion' into 'master'
Resolve "Fehler Eingabe Funktion" Closes #115 See merge request enrichment-2024/qivip!71
This commit is contained in:
@@ -192,13 +192,16 @@ class GameConsumer(AsyncWebsocketConsumer):
|
|||||||
is_correct = question_data['options'][answer_index]['is_correct']
|
is_correct = question_data['options'][answer_index]['is_correct']
|
||||||
print(is_correct)
|
print(is_correct)
|
||||||
except:
|
except:
|
||||||
user_input = str(answer_index).strip().lower()
|
user_input = str(answer_index).strip().lower().replace(" ", "")
|
||||||
correct_value = str(question_data['options'][0].get('value', '')).strip().lower()
|
correct_value = str(question_data['options'][0].get('value', '')).strip().lower().replace(" ", "")
|
||||||
print("Richtig",correct_value)
|
print("Richtig",correct_value)
|
||||||
|
print(user_input)
|
||||||
if user_input == correct_value:
|
if user_input == correct_value:
|
||||||
is_correct=True
|
is_correct=True
|
||||||
answer_index=0
|
answer_index=int(0)
|
||||||
print(is_correct)
|
print(is_correct)
|
||||||
|
else:
|
||||||
|
answer_index=int(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -50,15 +50,16 @@
|
|||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if request.session.mode == "learn" %}
|
{% if request.session.mode == "learn" %}
|
||||||
|
<form action="">
|
||||||
<input id="textanswer" type="text" placeholder="DEINE ANTWORT"
|
<input id="textanswer" type="text" placeholder="DEINE ANTWORT"
|
||||||
class="answer-option text-center p-2 bg-gray-100 hover:bg-blue-100 rounded-lg transition-colors duration-200 answer-option">
|
class="answer-option text-center p-2 bg-gray-100 hover:bg-blue-100 rounded-lg transition-colors duration-200 answer-option lg:w-80 ">
|
||||||
|
|
||||||
<button {% if request.session.mode == "learn" %}
|
<button {% if request.session.mode == "learn" %}
|
||||||
onclick="submitAnswer( -1 );" {% endif %}
|
onclick="submitAnswer( -1 );" {% endif %}
|
||||||
class="text-center p-2 bg-gray-100 hover:bg-blue-100 rounded-lg transition-colors duration-200 answer-option">
|
class="mt-2 text-center p-2 bg-gray-100 hover:bg-blue-100 rounded-lg transition-colors duration-200 answer-option">
|
||||||
abschicken
|
abschicken
|
||||||
</button>
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -27,13 +27,15 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
<form action="">
|
||||||
<input id="textanswer" type="text" placeholder="DEINE ANTWORT"
|
<input id="textanswer" type="text" placeholder="DEINE ANTWORT"
|
||||||
class="answer-option text-center p-2 bg-gray-100 hover:bg-blue-100 rounded-lg transition-colors duration-200 answer-option">
|
class="answer-option text-center p-2 bg-gray-100 hover:bg-blue-100 rounded-lg transition-colors duration-200 answer-option lg:w-80">
|
||||||
<button
|
<button
|
||||||
onclick="submitAnswer( -1 );"
|
onclick="submitAnswer( -1 );"
|
||||||
class="text-center p-2 bg-gray-100 hover:bg-blue-100 rounded-lg transition-colors duration-200 answer-option">
|
class="mt-2 text-center p-2 bg-gray-100 hover:bg-blue-100 rounded-lg transition-colors duration-200 answer-option">
|
||||||
abschicken
|
abschicken
|
||||||
</button>
|
</button>
|
||||||
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user