From ba19ce826491255e89199029f09db3f26988bfbe Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Sat, 27 Feb 2021 16:56:24 +0100 Subject: [PATCH] Fix v1 output format: real(feelsLike) --- share/we-lang/we-lang.go | 48 ++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/share/we-lang/we-lang.go b/share/we-lang/we-lang.go index 79970c0..2669056 100644 --- a/share/we-lang/we-lang.go +++ b/share/we-lang/we-lang.go @@ -661,24 +661,44 @@ func formatTemp(c cond) string { t = c.TempC2 } - hyphen := " - " + // hyphen := " - " + // if (config.Lang == "sl") { // hyphen = "-" // } - hyphen = ".." - explicitPlus := false - if c.FeelsLikeC < t { - if c.FeelsLikeC < 0 && t > 0 { - explicitPlus = true - } - return pad(fmt.Sprintf("%s%s%s °%s", color(c.FeelsLikeC, false), hyphen, color(t, explicitPlus), unitTemp[config.Imperial]), 15) - } else if c.FeelsLikeC > t { - if t < 0 && c.FeelsLikeC > 0 { - explicitPlus = true - } - return pad(fmt.Sprintf("%s%s%s °%s", color(t, false), hyphen, color(c.FeelsLikeC, explicitPlus), unitTemp[config.Imperial]), 15) - } + // hyphen = ".." + + explicitPlus1 := false + explicitPlus2 := false + if c.FeelsLikeC != t { + if t > 0 { + explicitPlus1 = true + } + if c.FeelsLikeC > 0 { + explicitPlus2 = true + } + if explicitPlus1 { + explicitPlus2 = false + } + return pad( + fmt.Sprintf("%s(%s) °%s", + color(t, explicitPlus1), + color(c.FeelsLikeC, explicitPlus2), + unitTemp[config.Imperial]), + 15) + } + // if c.FeelsLikeC < t { + // if c.FeelsLikeC < 0 && t > 0 { + // explicitPlus = true + // } + // return pad(fmt.Sprintf("%s%s%s °%s", color(c.FeelsLikeC, false), hyphen, color(t, explicitPlus), unitTemp[config.Imperial]), 15) + // } else if c.FeelsLikeC > t { + // if t < 0 && c.FeelsLikeC > 0 { + // explicitPlus = true + // } + // return pad(fmt.Sprintf("%s%s%s °%s", color(t, false), hyphen, color(c.FeelsLikeC, explicitPlus), unitTemp[config.Imperial]), 15) + // } return pad(fmt.Sprintf("%s °%s", color(c.FeelsLikeC, false), unitTemp[config.Imperial]), 15) }