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

Merge branch 'oob-fix' into 'develop'

fix out of bounds

See merge request !21
parents edb4a28c 6eed986d
No related branches found
No related tags found
1 merge request!21fix out of bounds
......@@ -249,7 +249,6 @@ func forecast(ctx context.Context, gddReq models.GddRequest, plantdate time.Time
Bins: bins,
}
}
return out
}
......@@ -363,7 +362,6 @@ func CalculateStages(ctx context.Context, request models.StageRequest) map[strin
Product: "CORN",
}
stageMatches := models.BuildStageMatches(request.Mode, request.Value)
// removing for now
// comparisonThread := dispatch.New[map[string]time.Time]()
// go comparisonGoRoutine(gddReq, request.PlantDate, stageMatches, request.Comparison, comparisonThread)
......@@ -381,7 +379,9 @@ func CalculateStages(ctx context.Context, request models.StageRequest) map[strin
// }
compResults := comparisonNormals(ctx, gddReq, request.PlantDate, stageMatches)
for k, v := range compResults {
out[k].ComparisonMean = v
if _, exists := out[k]; exists {
out[k].ComparisonMean = v
}
}
return out
......
......@@ -30,8 +30,11 @@ func GetGddValues(ctx context.Context, request models.GddRequest) models.GddResp
// if request.PlantingDate.Year() >= time.Now().Year() {
pdInt := request.PlantingDate.YearDay() - 1
gdds.MaxTemps = gdds.MaxTemps[pdInt:]
gdds.MinTemps = gdds.MinTemps[pdInt:]
// fmt.Println(pdInt)
if pdInt < len(gdds.MaxTemps) {
gdds.MinTemps = gdds.MinTemps[pdInt:]
gdds.MaxTemps = gdds.MaxTemps[pdInt:]
}
returnGdds := models.GddResponse{
Product: product.Name,
......
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