diff options
-rw-r--r-- | fatcat_scholar/templates/search.html | 12 |
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 %} {% 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 %} |