Skip to content

Commit

Permalink
Merge pull request #6 from mhelmetag/readable_condition_string
Browse files Browse the repository at this point in the history
Convert ratings to human readable
  • Loading branch information
mhelmetag authored May 24, 2021
2 parents 6f59b56 + 6282f9f commit b85288c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
35 changes: 31 additions & 4 deletions cmd/forecast.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
6 changes: 6 additions & 0 deletions cmd/search_interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++

Expand All @@ -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++

Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b85288c

Please sign in to comment.