From b347e5503313ff022f86879f9959e496813adca6 Mon Sep 17 00:00:00 2001 From: taoky Date: Mon, 28 Oct 2024 14:34:50 +0800 Subject: [PATCH 1/3] Put feedback inside

--- frontend/templates/hub.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/templates/hub.html b/frontend/templates/hub.html index 2484c4a..8f3cec1 100644 --- a/frontend/templates/hub.html +++ b/frontend/templates/hub.html @@ -145,7 +145,7 @@

{{ opened.name }}

-
需要提交反馈? +

需要提交反馈?

From 0058125e74e0d0e27dc33604627a51eb09d784ca Mon Sep 17 00:00:00 2001 From: taoky Date: Mon, 28 Oct 2024 14:49:03 +0800 Subject: [PATCH 2/3] Show latest feedback on page --- frontend/models.py | 7 +++++++ frontend/templates/challenge_feedback.html | 13 +++++++++---- frontend/views.py | 15 ++++++++------- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/frontend/models.py b/frontend/models.py index 17b6047..2b52d1d 100644 --- a/frontend/models.py +++ b/frontend/models.py @@ -138,3 +138,10 @@ class UnidirectionalFeedback(models.Model): def __str__(self) -> str: return f"{self.user} 对题目 {self.challenge_id} 的反馈" + + @property + def json(self): + return { + "contents": self.contents, + "datetime": self.submit_datetime, + } diff --git a/frontend/templates/challenge_feedback.html b/frontend/templates/challenge_feedback.html index 0c567b4..842459b 100644 --- a/frontend/templates/challenge_feedback.html +++ b/frontend/templates/challenge_feedback.html @@ -33,23 +33,28 @@

提交对题目 {{challenge_name}} 的反馈

你对该题目上一次提交反馈在 {{ human_latest_submit() }},需要等待提交后一小时方可再次提交。

+
+
+

上一次提交的内容:

+

{{ latest_feedback.contents }}

+
{% endverbatim %} {{ too_frequent|json_script:'too-frequent' }} -{{ latest_submit|json_script:'latest-submit' }} +{{ latest_feedback.json|json_script:'latest-feedback' }}