diff --git a/main.go b/main.go index e72819a..aa66a32 100644 --- a/main.go +++ b/main.go @@ -145,20 +145,6 @@ func main() { if err != nil { fmt.Printf("Error getting reading: %s\n", err) } else { - // Display GKI and level of ketosis - fmt.Printf("\nYour GKI is: %0.2f\n", reading.GKI) - switch { - case reading.GKI <= 1: - fmt.Println("You're in the highest level of ketosis.") - case reading.GKI < 3: - fmt.Println("You're in a high therapeutic level of ketosis.") - case reading.GKI < 6: - fmt.Println("You're in a moderate level of ketosis.") - case reading.GKI <= 9: - fmt.Println("You're in a low level of ketosis.") - default: - fmt.Println("You are not in ketosis.") - } appCtx.AddReading(reading) } case "2": @@ -205,7 +191,25 @@ func getReading() (Reading, error) { return Reading{}, errors.New("ketone reading cannot be less than 0") } - return NewReading(glucose, ketone), nil + reading := NewReading(glucose, ketone) + + // Display GKI and level of ketosis + fmt.Printf("\nYour GKI is: %0.2f\n", reading.GKI) + switch { + case reading.GKI <= 1: + fmt.Println("You're in the highest level of ketosis.") + case reading.GKI < 3: + fmt.Println("You're in a high therapeutic level of ketosis.") + case reading.GKI < 6: + fmt.Println("You're in a moderate level of ketosis.") + case reading.GKI <= 9: + fmt.Println("You're in a low level of ketosis.") + default: + fmt.Println("You are not in ketosis.") + } + + //return NewReading(glucose, ketone), nil + return reading, nil } func getUserInput(prompt string) (string, error) {