Reset temp after checking for valid location

This commit is contained in:
Andrew Scott 2022-07-26 22:20:04 -04:00
parent 7d59138191
commit 13f1e5da8c
Signed by: a
GPG key ID: 3EB62D0BBB8DB381

View file

@ -12,6 +12,7 @@ func advancedMenu(app *application) {
var option string
// Menu loop
for option != "0" {
fmt.Print("\nAdvanced Menu\n-------------\n\n")
@ -20,6 +21,7 @@ func advancedMenu(app *application) {
fmt.Println("2. Enter precise location")
fmt.Print("0. Back\n\n")
// Read user input
reader := bufio.NewReader(os.Stdin)
input, err := reader.ReadString('\n')
if err != nil {
@ -28,6 +30,7 @@ func advancedMenu(app *application) {
option = strings.TrimSuffix(input, "\n")
// Check user input
if option == "1" {
current := app.Config.Units
if current == "imperial" {
@ -38,6 +41,7 @@ func advancedMenu(app *application) {
fmt.Printf("\nChanged units from %s to %s...\n\n", current, app.Config.Units)
} else if option == "2" {
// Loop to validate location entered
var validLoc bool
for !validLoc {
getPreciseLocation(app)
@ -52,6 +56,7 @@ func advancedMenu(app *application) {
}
printWeather(app)
app.Forecast.Main.Temp = 0.00
}
}
}