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

rename

parent ae14c172
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,6 @@ import (
// @Produce json
// @Success 200 {object} models.GefsGddResponse
// @Failure 400 {object} errors.StandardError
// @Param year query int true "Year to get gdd for"
// @Param product query string true "Crop to calculate gdd for" Enums(corn, soybean, sunflower, tomato, sugar_beet, peanut, cotton, potato, wheat, pea, oat, spring_wheat, rice, sorghum)
// @Param latitude query number true "Latitude to search for"
// @Param longitude query number true "Longitude to search for"
......
......@@ -123,13 +123,6 @@ var doc = `{
],
"summary": "Get GDD values calculated from GEFS",
"parameters": [
{
"type": "integer",
"description": "Year to get gdd for",
"name": "year",
"in": "query",
"required": true
},
{
"enum": [
"corn",
......
......@@ -108,13 +108,6 @@
],
"summary": "Get GDD values calculated from GEFS",
"parameters": [
{
"type": "integer",
"description": "Year to get gdd for",
"name": "year",
"in": "query",
"required": true
},
{
"enum": [
"corn",
......
......@@ -123,11 +123,6 @@ paths:
- application/json
description: Get GDD values calculated from GEFS
parameters:
- description: Year to get gdd for
in: query
name: year
required: true
type: integer
- description: Crop to calculate gdd for
enum:
- corn
......
......@@ -35,7 +35,7 @@ func (r GddRequest) Validate() error {
)
}
func (r GddRequest) ValidateNormals() error {
func (r GddRequest) ValidateNoYear() error {
return validation.ValidateStruct(&r,
validation.Field(&r.Product, validation.Required, validation.Length(1, 100)),
validation.Field(&r.Latitude, validation.Required, validation.Min(-90.0), validation.Max(90.0)),
......@@ -67,7 +67,7 @@ func (r GddRequest) Build(c *fiber.Ctx) GddRequest {
panic(errors.BAD_REQUEST)
}
} else {
if rNew.ValidateNormals() != nil {
if rNew.ValidateNoYear() != nil {
panic(errors.BAD_REQUEST)
}
}
......
......@@ -17,7 +17,11 @@ func GetGefsGddValues(request models.GddRequest) models.GefsGddResponse {
for i := 0; i < 10; i++ {
temp := g[i]
gdds = append(gdds, utils.CalculateSingleGdd(temp.MinTemp, temp.MaxTemp, product))
value := utils.CalculateSingleGdd(temp.MinTemp, temp.MaxTemp, product)
if request.Accumulate && i > 0 {
value += gdds[len(gdds)-1]
}
gdds = append(gdds, value)
}
returnGdds = models.GefsGddResponse{
......
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