fix some useranswer compare issuses

This commit is contained in:
Ross
2024-01-10 21:06:49 +00:00
parent 76b4746b13
commit 8d0ffbba06
12 changed files with 86 additions and 96 deletions
+3 -9
View File
@@ -76,8 +76,8 @@ def image_directory_path(instance, filename):
def get_answer_compare(s):
s = s.strip().lower()
s = s.translate(str.maketrans("", "", string.punctuation.replace("#", "")))
s = s.strip().translate(str.maketrans("", "", string.punctuation.replace("#", ""))).lower()
s = " ".join(s.split())
return s
@@ -804,13 +804,7 @@ class UserAnswer(UserAnswerBase):
self.score = Answer.MarkOptions.UNMARKED
if self.answer:
self.answer = self.answer.strip()
s = self.answer.lower()
s = s.translate(
str.maketrans("", "", string.punctuation.replace("#", ""))
).strip()
self.answer_compare = s
self.answer_compare = get_answer_compare(self.answer)
else:
self.answer = ""
self.answer_compare = ""
@@ -1,13 +0,0 @@
{% extends 'rapids/base.html' %}
{% block content %}
CID: {{ciduseranswer.cid}}<br/>
User: {{ciduseranswer.user}}<br/>
Exam: {{ciduseranswer.exam}}<br/>
{{ciduseranswer.question}}<br/>
Normal: {{ciduseranswer.normal}}<br/>
Answer: {{ciduseranswer.answer}}<br/>
Score: {{ciduseranswer.get_answer_score}}<br/>
<a href="{% url 'rapids:user_answer_delete' ciduseranswer.id %}">Delete answer</a>
{% endblock content %}
@@ -0,0 +1,13 @@
{% extends 'rapids/base.html' %}
{% block content %}
CID: {{useranswer.cid}}<br/>
User: {{useranswer.user}}<br/>
Exam: {{useranswer.exam}}<br/>
{{useranswer.question}}<br/>
Normal: {{useranswer.normal}}<br/>
Answer: {{useranswer.answer}}<br/>
Score: {{useranswer.get_answer_score}}<br/>
<a href="{% url 'rapids:user_answer_delete' useranswer.id %}">Delete answer</a>
{% endblock content %}