From 9de6f55e801559e8c1d8cead8e90a19bdedb41b0 Mon Sep 17 00:00:00 2001 From: Ihsan Ullah Date: Mon, 21 Aug 2023 15:47:47 +0500 Subject: [PATCH 1/3] show/hide child submissions --- src/apps/pages/views.py | 5 +++++ src/templates/pages/server_status.html | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/apps/pages/views.py b/src/apps/pages/views.py index 7395d416a..a48b6d497 100644 --- a/src/apps/pages/views.py +++ b/src/apps/pages/views.py @@ -62,13 +62,18 @@ def get_context_data(self, *args, **kwargs): if not self.request.user.is_staff: raise HttpResponse(status=404) + show_child_submissions = self.request.GET.get('show_child_submissions', False) + qs = Submission.objects.all() qs = qs.filter(created_when__gte=now() - timedelta(days=2)) + if not show_child_submissions: + qs = qs.filter(parent__isnull=True) qs = qs.order_by('-created_when') qs = qs.select_related('phase__competition', 'owner') context = super().get_context_data(*args, **kwargs) context['submissions'] = qs[:250] + context['show_child_submissions'] = show_child_submissions return context diff --git a/src/templates/pages/server_status.html b/src/templates/pages/server_status.html index 8e4bc172b..9b55e4b79 100644 --- a/src/templates/pages/server_status.html +++ b/src/templates/pages/server_status.html @@ -7,6 +7,9 @@ {% block content %}

Recent submissions (up to 250 or 2 days old)

+ @@ -73,4 +76,22 @@

Monitor queues

+ + {% endblock %} From d70e559b328e9dd24d072ea3f7f501c4573592aa Mon Sep 17 00:00:00 2001 From: Ihsan Ullah Date: Mon, 21 Aug 2023 16:02:26 +0500 Subject: [PATCH 2/3] spelling mistake fixed, show parent id when has parent, show explanation for child submissions --- src/templates/pages/server_status.html | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/templates/pages/server_status.html b/src/templates/pages/server_status.html index 9b55e4b79..7774e4441 100644 --- a/src/templates/pages/server_status.html +++ b/src/templates/pages/server_status.html @@ -8,12 +8,20 @@

Recent submissions (up to 250 or 2 days old)

+ + +
Competition
+ {% if show_child_submissions %} + + {% endif %} @@ -29,6 +37,9 @@

Recent submissions (up to 250 or 2 days old)

+ {% if show_child_submissions %} + + {% endif %} From fd1afada0348c246196afdac3a190426cf5e8c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Pav=C3=A3o?= Date: Mon, 21 Aug 2023 14:14:14 +0200 Subject: [PATCH 3/3] Update server_status.html --- src/templates/pages/server_status.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates/pages/server_status.html b/src/templates/pages/server_status.html index 2a862b510..a6dbc741f 100644 --- a/src/templates/pages/server_status.html +++ b/src/templates/pages/server_status.html @@ -11,7 +11,7 @@

Recent submissions (up to 250 or 2 days old)

Show child submissions
Competition Submission PKParent PKSubmitter Hostname Submitted at
{{ submission.phase.competition.title }} {{ submission.pk }}{{ submission.parent.pk }}{{ submission.owner.username }} {{ submission.worker_hostname }} {{ submission.created_when|timesince }} ago