From 6282f9f5e085eb101171bf04d272c0870f0edd9f Mon Sep 17 00:00:00 2001 From: Max Helmetag Date: Sun, 23 May 2021 17:56:54 -0700 Subject: [PATCH] convert ratings to human readable, styling, bump version --- cmd/forecast.go | 35 +++++++++++++++++++++++++++++++---- cmd/search_interactive.go | 6 ++++++ main.go | 2 +- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/cmd/forecast.go b/cmd/forecast.go index bc0e41c..37f993a 100644 --- a/cmd/forecast.go +++ b/cmd/forecast.go @@ -43,13 +43,40 @@ func Forecast(srID string, d int) { ts := fmt.Sprintf("%d/%d/%d", t.Month(), t.Day(), t.Year()) cAM := cs[i].AM - rangeAM := fmt.Sprintf("%.1f - %.1f", cAM.MinHeight, cAM.MaxHeight) - table.Append([]string{ts, "AM", cAM.Rating, rangeAM, cAM.HumanRelation}) + rangeAM := fmt.Sprintf("%.1f-%.1fft", cAM.MinHeight, cAM.MaxHeight) + table.Append([]string{ts, "AM", convertRating(cAM.Rating), rangeAM, cAM.HumanRelation}) cPM := cs[i].PM - rangePM := fmt.Sprintf("%.1f - %.1f", cAM.MinHeight, cAM.MaxHeight) - table.Append([]string{ts, "PM", cPM.Rating, rangePM, cPM.HumanRelation}) + rangePM := fmt.Sprintf("%.1f-%.1fft", cAM.MinHeight, cAM.MaxHeight) + table.Append([]string{ts, "PM", convertRating(cPM.Rating), rangePM, cPM.HumanRelation}) } table.Render() } + +func convertRating(rating string) string { + switch rating { + case "FLAT": + return "Flat" + case "VERY_POOR": + return "Very Poor" + case "POOR": + return "Poor" + case "POOR_TO_FAIR": + return "Poor to Fair" + case "FAIR": + return "Fair" + case "FAIR_TO_GOOD": + return "Fair to Good" + case "GOOD": + return "Good" + case "VERY_GOOD": + return "Very Good" + case "GOOD_TO_EPIC": + return "Good to Epic" + case "EPIC": + return "Epic" + default: + return "Unkown" + } +} diff --git a/cmd/search_interactive.go b/cmd/search_interactive.go index c29b935..5a8622c 100644 --- a/cmd/search_interactive.go +++ b/cmd/search_interactive.go @@ -75,6 +75,9 @@ func promptOrBail(c surflinef.Client, ts []surflinef.Taxonomy, step int) error { } nts, err := getTaxonomy(c, id) + if err != nil { + return err + } step++ @@ -86,6 +89,9 @@ func promptOrBail(c surflinef.Client, ts []surflinef.Taxonomy, step int) error { } nts, err := getTaxonomy(c, id) + if err != nil { + return err + } step++ diff --git a/main.go b/main.go index 946cc4d..5096065 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( "github.com/urfave/cli/v2" ) -const version = "2.3.0" +const version = "2.3.1" func main() { var srID string