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

if no data
master
Elis Hirwing 4 years ago
parent 292acd2317
commit f1a1bdc7ab
Signed by: etu
GPG Key ID: D57EFA625C9A925F
  1. 12
      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")

Loading…
Cancel
Save