From d3a366a1b7ebeec78fdaf73d681d9268d986fa77 Mon Sep 17 00:00:00 2001 From: Chteufleur Date: Tue, 6 Oct 2015 20:18:48 +0200 Subject: [PATCH] [Bug fix] Print horodat in index like 09h00 --- controllers/default.go | 10 +++++++++- views/base/navbar.html | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/controllers/default.go b/controllers/default.go index 199eaad..9d8561f 100644 --- a/controllers/default.go +++ b/controllers/default.go @@ -52,7 +52,15 @@ func getLastTemps() ([]SensorPrint) { horodatTmp := t.HorodateGMT horodatTmp = horodatTmp.Add(time.Duration(timezoneOffset)*time.Second) h, m, _ := horodatTmp.Clock() - sens.Horodate = strconv.Itoa(h)+"h"+strconv.Itoa(m) + hStr := strconv.Itoa(h) + if h < 10 { + hStr = "0"+hStr + } + mStr := strconv.Itoa(m) + if m < 10 { + mStr = "0"+mStr + } + sens.Horodate = hStr+"h"+mStr values = append(values, *sens) } diff --git a/views/base/navbar.html b/views/base/navbar.html index b8ffdba..559d11e 100644 --- a/views/base/navbar.html +++ b/views/base/navbar.html @@ -17,11 +17,11 @@ class="active" {{end}} >Temperatures -
  • Consommation electrique
  • + >Consommation electrique -->