From 003148abbee57de340980972dfa23b7e82aaef70 Mon Sep 17 00:00:00 2001 From: Andrew Grant Date: Tue, 9 Jan 2024 14:11:41 -0500 Subject: [PATCH] Finalize Priority Group Dividers (#184) Co-authored-by: MinusKelvin --- OpenBench/static/style.css | 6 ++++++ OpenBench/templatetags/mytags.py | 13 ++++++++++++- OpenBench/views.py | 12 ++---------- Templates/OpenBench/index.html | 22 +++++++++++++++------- 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/OpenBench/static/style.css b/OpenBench/static/style.css index fcf74d3..2f6defa 100644 --- a/OpenBench/static/style.css +++ b/OpenBench/static/style.css @@ -174,6 +174,12 @@ body, html, main{ height: 1rem; } +#content .table-spacer-small th, #content .table-spacer-small tr { + background-color: #171717; + height: 0.4rem; + padding: 0px; +} + /* Generic Table CSS for all Tables */ #content table { diff --git a/OpenBench/templatetags/mytags.py b/OpenBench/templatetags/mytags.py index ae811e5..f2ac16f 100644 --- a/OpenBench/templatetags/mytags.py +++ b/OpenBench/templatetags/mytags.py @@ -379,4 +379,15 @@ register.filter('git_diff_text', git_diff_text) register.filter('test_is_smp_odds' , test_is_smp_odds ) register.filter('test_is_time_odds' , test_is_time_odds ) -register.filter('test_is_fischer' , test_is_fischer ) \ No newline at end of file +register.filter('test_is_fischer' , test_is_fischer ) + + +@register.filter +def next(iterable, index): + try: return iterable[int(index) + 1] + except: return None + +@register.filter +def previous(iterable, index): + try: return iterable[int(index) - 1] + except: return None \ No newline at end of file diff --git a/OpenBench/views.py b/OpenBench/views.py index a26e2f8..fa2c94e 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -251,14 +251,6 @@ def profile_config(request): # TEST LIST VIEWS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -def priority_grouped(active): - active_grouped = [] - for t in active: - if len(active_grouped) == 0 or active_grouped[-1]["priority"] != t.priority: - active_grouped.append({"priority": t.priority, "tests": []}) - active_grouped[-1]["tests"].append(t) - return active_grouped - def index(request, page=1): pending = OpenBench.utils.get_pending_tests() @@ -270,7 +262,7 @@ def index(request, page=1): data = { 'pending' : pending, - 'active' : priority_grouped(active), + 'active' : active, 'completed' : completed[start:end], 'awaiting' : awaiting, 'paging' : paging, @@ -290,7 +282,7 @@ def user(request, username, page=1): data = { 'pending' : pending, - 'active' : priority_grouped(active), + 'active' : active, 'completed' : completed[start:end], 'awaiting' : awaiting, 'paging' : paging, diff --git a/Templates/OpenBench/index.html b/Templates/OpenBench/index.html index 8d9dade..1c490c4 100644 --- a/Templates/OpenBench/index.html +++ b/Templates/OpenBench/index.html @@ -1,5 +1,7 @@ {% extends "OpenBench/base.html" %} +{% load mytags %} + {% block content %} @@ -32,13 +34,19 @@ {% if active %} - {% for group in active %} - - {% for test in group.tests %} - - {% include "OpenBench/Blocks/testsummary.html" %} - - {% endfor %} + {% for test in active %} + + + {% with prev_test=active|previous:forloop.counter0 %} + {% if prev_test and prev_test.priority != test.priority %} + + + {% endif %} + {% endwith %} + + + {% include "OpenBench/Blocks/testsummary.html" %} + {% endfor %} {% endif %}
Active {{status}}
Priority {{group.priority}}