From df34e547ad30753019c5b7a1eacb69184776b8ea Mon Sep 17 00:00:00 2001 From: Bao Le <127121163+BaoLe106@users.noreply.github.com> Date: Thu, 22 Feb 2024 12:05:06 +0800 Subject: [PATCH] Copyright and fix for test formatter (#107) --- dmoj/urls.py | 20 ------------------- judge/views/test_formatter/test_formatter.py | 5 ++++- .../download_test_formatter.html | 9 +++++++++ .../test_formatter/edit_test_formatter.html | 9 +++++++++ templates/test_formatter/test_formatter.html | 14 ++++++++++++- 5 files changed, 35 insertions(+), 22 deletions(-) diff --git a/dmoj/urls.py b/dmoj/urls.py index 5330504..a7dacb8 100644 --- a/dmoj/urls.py +++ b/dmoj/urls.py @@ -429,26 +429,6 @@ urlpatterns = [ markdown_editor.MarkdownEditor.as_view(), name="markdown_editor", ), - url( - r"^test_formatter/", - include( - [ - url( - r"^$", test_formatter.TestFormatter.as_view(), name="test_formatter" - ), - url( - r"^edit_page$", - test_formatter.EditTestFormatter.as_view(), - name="edit_page", - ), - url( - r"^download_page$", - test_formatter.DownloadTestFormatter.as_view(), - name="download_page", - ), - ] - ), - ), url( r"^submission_source_file/(?P(\w|\.)+)", submission.SubmissionSourceFileView.as_view(), diff --git a/judge/views/test_formatter/test_formatter.py b/judge/views/test_formatter/test_formatter.py index 5336297..4818bcc 100644 --- a/judge/views/test_formatter/test_formatter.py +++ b/judge/views/test_formatter/test_formatter.py @@ -25,8 +25,11 @@ def id_to_path(id): def get_names_in_archive(file_path): + suffixes = ("inp", "out", "INP", "OUT") with ZipFile(os.path.join(settings.MEDIA_ROOT, file_path)) as f: - result = [x for x in f.namelist() if not x.endswith("/")] + result = [ + x for x in f.namelist() if not x.endswith("/") and x.endswith(suffixes) + ] return list(sorted(result, key=tf_utils.natural_sorting_key)) diff --git a/templates/test_formatter/download_test_formatter.html b/templates/test_formatter/download_test_formatter.html index 2fddc4e..59114f9 100644 --- a/templates/test_formatter/download_test_formatter.html +++ b/templates/test_formatter/download_test_formatter.html @@ -23,6 +23,12 @@ .button { display:inline-block; } + .copyright { + position: absolute; + bottom: 48px; + left: 50%; + transform: translate(-50%, -50%); + } {% endblock %} @@ -76,6 +82,9 @@ {{_('Edit')}} + diff --git a/templates/test_formatter/edit_test_formatter.html b/templates/test_formatter/edit_test_formatter.html index aebcf0e..4515609 100644 --- a/templates/test_formatter/edit_test_formatter.html +++ b/templates/test_formatter/edit_test_formatter.html @@ -23,6 +23,12 @@ .preview-container { padding-bottom: 16px; } + .copyright { + position: absolute; + bottom: 48px; + left: 50%; + transform: translate(-50%, -50%); + } #preview { background-color: rgb(220, 220, 220); border: solid 2px rgb(180, 180, 180); @@ -127,5 +133,8 @@ + {% endblock %} diff --git a/templates/test_formatter/test_formatter.html b/templates/test_formatter/test_formatter.html index 5831f1d..9c3311b 100644 --- a/templates/test_formatter/test_formatter.html +++ b/templates/test_formatter/test_formatter.html @@ -1,5 +1,14 @@ {% extends 'base.html' %} - +{% block media %} + +{% endblock %} {% block body %}
@@ -7,5 +16,8 @@ {{ form }}
+
{% endblock %}