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