From 27165b00d79a5f5813e543453836fbbe86eb8c0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81lvaro=20=27Darkenend=27=20Real?=
<34766606+Darkenend@users.noreply.github.com>
Date: Sat, 23 May 2020 13:10:00 +0200
Subject: [PATCH] Time Display Hotfix
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Álvaro 'Darkenend' Real <34766606+Darkenend@users.noreply.github.com>
---
templates/historic/result.html.twig | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/templates/historic/result.html.twig b/templates/historic/result.html.twig
index d95b4cc..64df70e 100644
--- a/templates/historic/result.html.twig
+++ b/templates/historic/result.html.twig
@@ -64,11 +64,9 @@
"20": "Aston Martin Vantage V8", "21": "Honda NSX Evo", "22": "McLaren 720S GT3", "23": "Porsche 911 II GT3 R"}) }}
- {% set bestlap_split = (result.bestlap | split('', 3)) %}
- {% set ms = bestlap_split[1] %}
- {% set seconds = bestlap_split[0] %}
+ {% set ms = result.bestlap[-3:] %}
+ {% set seconds = result.bestlap[:-3] %}
{% set hours = seconds / 3600 % 60 %}
-
{% if hours < 1 %}
{# set hours to nothing #}
{% set hours = null %}
@@ -76,10 +74,8 @@
{# output hours with a colon: #}
{% set hours = hours|number_format ~ ':' %}
{% endif %}
-
{# set minutes remain but no seconds and with a colon #}
{% set minutes = seconds / 60 % 60 ~ ':' %}
-
{# set seconds but no minutes or hours #}
{% set seconds = seconds % 60 %}
{% if seconds < 10 %}
@@ -89,10 +85,9 @@
{% if hours != null %}{{ hours }}{% endif %}{{ minutes }}{{ seconds }}.{{ ms }}
|
- {% set ms = result.result[3:] %}
- {% set seconds = result.result[:result.result|length-3] %}
+ {% set ms = result.result[-3:] %}
+ {% set seconds = result.result[:-3] %}
{% set hours = seconds / 3600 % 60 %}
-
{% if hours < 1 %}
{# set hours to nothing #}
{% set hours = null %}
@@ -100,13 +95,13 @@
{# output hours with a colon: #}
{% set hours = hours|number_format ~ ':' %}
{% endif %}
-
{# set minutes remain but no seconds and with a colon #}
- {% set minutes = seconds / 60 % 60 ~ ':' %}
+ {% set minutes = seconds / 60 % 60 %}
{% if minutes < 10 %}
{# add a leading zero if minutes are less than 10 #}
{% set minutes = '0' ~ minutes %}
{% endif %}
+ {% set minutes = minutes ~ ':' %}
{# set seconds but no minutes or hours #}
{% set seconds = seconds % 60 %}
{% if seconds < 10 %}
|