Improve Searching

Fix ordering of searches to be most-recent first
Fix for fixed-game tests not matching due to wrong arguments
Display datestamps for searched tests
Modify base template block to drop the <tr> tags
This commit is contained in:
andrew committed 2023-08-18 13:09:26 -04:00
1 parent a1f8efb55a
commit f76de2bc56
5 files changed
+57 -32

No files matched your search

+1 -1
View File
@@ -382,7 +382,7 @@ def search(request):
filtered.append(test) filtered.append(test)
error = 'No matching tests found' if not len(filtered) else None error = 'No matching tests found' if not len(filtered) else None
return render(request, 'search.html', { 'tests' : filtered }, error=error) return render(request, 'search.html', { 'tests' : reversed(filtered) }, error=error)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# GENERAL DATA TABLE VIEWS # # GENERAL DATA TABLE VIEWS #
+13 -15
View File
@@ -1,16 +1,14 @@
{% load mytags %} {% load mytags %}
<tr> <td><a href="/user/{{test.author}}">{{test.author|capfirst|slice:":6"}}</a></td>
<td><a href="/user/{{test.author}}">{{test.author|capfirst|slice:":6"}}</a></td> <td>{{test.dev_engine}}</td>
<td>{{test.dev_engine}}</td> <td>
<td> <a href="/test/{{test.id}}">{{test|prettyDevName}}</a>
<a href="/test/{{test.id}}">{{test|prettyDevName}}</a> {% if test.error %} <span style="color: red">*</span> {% endif %}
{% if test.error %} <span style="color: red">*</span> {% endif %} {% if test|testIsFRC %} <span style="color: green">*</span> {% endif %}
{% if test|testIsFRC %} <span style="color: green">*</span> {% endif %} </td>
</td> <td class="textcenter"><a href="{{test|gitDiffLink}}">diff</a></td>
<td class="textcenter"><a href="{{test|gitDiffLink}}">diff</a></td> <td>
<td> {{test.dev_time_control}}
{{test.dev_time_control}} {% if test.dev_time_control != test.base_time_control %} <span style="color: yellow">*</span> {% endif %}
{% if test.dev_time_control != test.base_time_control %} <span style="color: yellow">*</span> {% endif %} </td>
</td> <td class='statblock statblock-{{test|testResultColour}}'><strong>{{test|shortStatBlock|linebreaksbr}}</strong></td>
<td class='statblock statblock-{{test|testResultColour}}'><strong>{{test|shortStatBlock|linebreaksbr}}</strong></td>
</tr>
+26 -10
View File
@@ -23,18 +23,34 @@
<script> <script>
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
var timestamps = document.getElementsByClassName('timestamp'); {
var timestamps = document.getElementsByClassName('timestamp');
var options = { var options = {
year : 'numeric', month : '2-digit', year : 'numeric', month : '2-digit',
day : '2-digit', hour : '2-digit', day : '2-digit', hour : '2-digit',
minute : '2-digit', second : '2-digit', minute : '2-digit', second : '2-digit',
hour12 : false, hour12 : false,
}; };
for (var i = 0; i < timestamps.length; i++) { for (var i = 0; i < timestamps.length; i++) {
var date = new Date(1000 * timestamps[i].innerHTML); var date = new Date(1000 * timestamps[i].innerHTML);
timestamps[i].innerHTML = date.toLocaleString(undefined, options); timestamps[i].innerHTML = date.toLocaleString(undefined, options);
}
}
{
var datestamps = document.getElementsByClassName('datestamp');
var options = {
year : 'numeric', month : '2-digit',
day : '2-digit',
};
for (var i = 0; i < datestamps.length; i++) {
var date = new Date(1000 * datestamps[i].innerHTML);
datestamps[i].innerHTML = date.toLocaleString(undefined, options);
}
} }
}, false); }, false);
+12 -4
View File
@@ -11,7 +11,9 @@
{% if pending %} {% if pending %}
<tr class="table-header"><th colspan='6'>Pending</th></tr> <tr class="table-header"><th colspan='6'>Pending</th></tr>
{% for test in pending %} {% for test in pending %}
{% include "OpenBench/Blocks/testsummary.html" %} <tr>
{% include "OpenBench/Blocks/testsummary.html" %}
</tr>
{% endfor %} {% endfor %}
<tr class="table-spacer"><th colspan='6'></th></tr> <tr class="table-spacer"><th colspan='6'></th></tr>
{% endif %} {% endif %}
@@ -20,7 +22,9 @@
{% if awaiting %} {% if awaiting %}
<tr class="table-header"><th colspan='6'>Awaiting Artifacts</th></tr> <tr class="table-header"><th colspan='6'>Awaiting Artifacts</th></tr>
{% for test in awaiting %} {% for test in awaiting %}
{% include "OpenBench/Blocks/testsummary.html" %} <tr>
{% include "OpenBench/Blocks/testsummary.html" %}
</tr>
{% endfor %} {% endfor %}
<tr class="table-spacer"><th colspan='6'></th></tr> <tr class="table-spacer"><th colspan='6'></th></tr>
{% endif %} {% endif %}
@@ -29,7 +33,9 @@
{% if active %} {% if active %}
<tr class="table-header"><th colspan='6'>Active {{status}}</th></tr> <tr class="table-header"><th colspan='6'>Active {{status}}</th></tr>
{% for test in active %} {% for test in active %}
{% include "OpenBench/Blocks/testsummary.html" %} <tr>
{% include "OpenBench/Blocks/testsummary.html" %}
</tr>
{% endfor %} {% endfor %}
<tr class="table-spacer"><th colspan='6'></th></tr> <tr class="table-spacer"><th colspan='6'></th></tr>
{% endif %} {% endif %}
@@ -39,7 +45,9 @@
<!-- Tests which have already finished --> <!-- Tests which have already finished -->
<tr class="table-header"><th colspan='6'>Finished</th></tr> <tr class="table-header"><th colspan='6'>Finished</th></tr>
{% for test in completed %} {% for test in completed %}
{% include "OpenBench/Blocks/testsummary.html" %} <tr>
{% include "OpenBench/Blocks/testsummary.html" %}
</tr>
{% endfor %} {% endfor %}
</table> </table>
+5 -2
View File
@@ -65,7 +65,7 @@
<select id="test-mode" name="test-mode"> <select id="test-mode" name="test-mode">
<option value="" selected>All Test Types</option> <option value="" selected>All Test Types</option>
<option value="SPRT">SPRT</option> <option value="SPRT">SPRT</option>
<option value="FIXED">FIXED</option> <option value="GAMES">FIXED</option>
</select><br> </select><br>
</div> </div>
<div class="row"> <div class="row">
@@ -150,7 +150,10 @@
<table class="test-list stripes hoverable"> <table class="test-list stripes hoverable">
{% for test in tests %} {% for test in tests %}
{% include "OpenBench/Blocks/testsummary.html" %} <tr>
<td class="datestamp">{{test.creation|date:"U"}}</td>
{% include "OpenBench/Blocks/testsummary.html" %}
</tr>
{% endfor %} {% endfor %}
</table> </table>
{% endblock %} {% endblock %}