aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/templates/search.html
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-08-06 15:41:14 -0700
committerBryan Newbold <bnewbold@archive.org>2020-08-06 19:01:12 -0700
commitf0dcc9dafcb280ff522ff4fc8739af4e46cb8768 (patch)
treee7b707a25edc6abf77d26bf3469dcb8e8d2708b5 /fatcat_scholar/templates/search.html
parent8b51716fa6bb66f1ac3cf75ce5b64b4138e5935e (diff)
downloadfatcat-scholar-f0dcc9dafcb280ff522ff4fc8739af4e46cb8768.tar.gz
fatcat-scholar-f0dcc9dafcb280ff522ff4fc8739af4e46cb8768.zip
handle longer query times
Diffstat (limited to 'fatcat_scholar/templates/search.html')
-rw-r--r--fatcat_scholar/templates/search.html12
1 files changed, 10 insertions, 2 deletions
diff --git a/fatcat_scholar/templates/search.html b/fatcat_scholar/templates/search.html
index ee95af3..0216f87 100644
--- a/fatcat_scholar/templates/search.html
+++ b/fatcat_scholar/templates/search.html
@@ -1,6 +1,14 @@
{% import "search_macros.html" as search_macros %}
{% extends "base.html" %}
+{% macro format_query_time(query_time_ms) -%}
+ {% if query_time_ms >= 10000 %}
+ {{ "{:0.3}".format(hits.query_time_ms/1000.0) }}sec
+ {% else %}
+ {{ "{:0.2}".format(hits.query_time_ms/1000.0) }}sec
+ {% endif %}
+{%- endmacro %}
+
{% block fullmain %}
<div class="tablet-only" style="margin-top: 1.0em;">
@@ -23,7 +31,7 @@
{% if hits %}
<span style="font-size: 1.5em;">{{ "{:,}".format(hits.count_found) }}</span>
Hits
- <span style="color: rgba(0,0,0,0.4);">in {{ "{:0.2}".format(hits.query_time_ms/1000.0) }}sec</span>
+ <span style="color: rgba(0,0,0,0.4);">in {{ format_query_time(hits.query_time_ms) }}</span>
{% else %}
&nbsp;
{% endif %}
@@ -38,7 +46,7 @@
Hits
</div>
<div style="text-align: right;">
- <span style="color: rgba(0,0,0,0.4);">in {{ "{:0.2}".format(hits.query_time_ms/1000.0) }}sec</span>
+ <span style="color: rgba(0,0,0,0.4);">in {{ format_query_time(hits.query_time_ms) }}</span>
</div>
<div class="ui clearing divider"></div>
{% endif %}