Browse Source

Pollen: Hide lines that doesn't contain any useful data and hide table

if no data
master
Elis Hirwing 2 years ago
parent
commit
f1a1bdc7ab
Signed by: etu <elis@hirwing.se> GPG Key ID: D57EFA625C9A925F
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      statusscreen-pollen.go

+ 12
- 0
statusscreen-pollen.go View File

@@ -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")


Loading…
Cancel
Save