From f1a1bdc7ab810f0e9d144e3277ef66a9bd0f05c5 Mon Sep 17 00:00:00 2001 From: Elis Hirwing Date: Sat, 21 Jul 2018 22:45:10 +0200 Subject: [PATCH] Pollen: Hide lines that doesn't contain any useful data and hide table if no data --- statusscreen-pollen.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/statusscreen-pollen.go b/statusscreen-pollen.go index 795e429..0039493 100644 --- a/statusscreen-pollen.go +++ b/statusscreen-pollen.go @@ -76,6 +76,14 @@ func (pollen *Pollen) GetOutput() []string { } for _, v2 := range v.Pollen { + // Drop rows that have the status: "inga halter" or "ingen rapport" + if v2.Day0Description[:3] == "ing" && + v2.Day1Description[:3] == "ing" && + v2.Day2Description[:3] == "ing" && + v2.Day3Description[:3] == "ing" { + continue + } + table.Append([]string{ v2.Type, v2.Day0Description, @@ -86,6 +94,10 @@ func (pollen *Pollen) GetOutput() []string { } } + if table.NumLines() == 0 { + return []string{} + } + table.Render() return strings.Split(b.String(), "\n")