Skip to content
Snippets Groups Projects
Commit b8248930 authored by Tucker Gary Siegel's avatar Tucker Gary Siegel
Browse files

fix error message

parent 97017041
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,6 @@ package persistence
import (
"context"
"fmt"
"strings"
"github.com/tgs266/dawn-go-common/common"
......@@ -86,11 +85,9 @@ func GddFindFirstByYearAndLocation(year int, location entities.Location) entitie
coll := Session.Collection("gdd")
filter := buildLocationRequest(location, &year)
fmt.Println(filter)
var g entities.Gdd
err := coll.FindOne(Session.Ctx, filter).Decode(&g)
if err != nil {
fmt.Println(err)
panic(config.NO_DATA_FOUND.PutDetail("reason", "gdd"))
}
......@@ -120,7 +117,7 @@ func GetLastNormalsYearly(location entities.Location) []entities.Gdd {
var n []entities.Gdd
cursor, err := coll.Find(Session.Ctx, filter, options.Find().SetLimit(30))
if err != nil {
panic(config.NO_DATA_FOUND.PutDetail("reason", "normal_gdd"))
panic(config.NO_DATA_FOUND.PutDetail("reason", "gdd"))
}
if err = cursor.All(Session.Ctx, &n); err != nil {
......@@ -128,7 +125,7 @@ func GetLastNormalsYearly(location entities.Location) []entities.Gdd {
}
if len(n) == 0 {
panic(config.NO_DATA_FOUND.PutDetail("reason", "normal_gdd"))
panic(config.NO_DATA_FOUND.PutDetail("reason", "gdd"))
}
return n
......
......@@ -37,7 +37,6 @@ func GetFullYearGddValues(ctx common.DawnCtx, request models.GddRequest) models.
func GetGddValues(ctx common.DawnCtx, request models.GddRequest) models.GddResponse {
product := enums.GetProductFromString(request.Product)
var gdds entities.Gdd
fmt.Println(request)
if request.Year == time.Now().Year() {
gdds = persistence.CurrentGddFindFirstByYearAndLocation(ctx, request.BuildLocation())
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment