diff --git a/main b/main index 25c9a88..63927d9 100755 Binary files a/main and b/main differ diff --git a/modules/structs/productpipeline.go b/modules/structs/productpipeline.go index 8e9b5b2..ef3ae85 100644 --- a/modules/structs/productpipeline.go +++ b/modules/structs/productpipeline.go @@ -3,7 +3,6 @@ package structs // database model type PipelineProduct struct { Id string - Name string Votes int } diff --git a/routers/router/api/v1/productpipeline/productpipeline.go b/routers/router/api/v1/productpipeline/productpipeline.go index 32f1474..f656877 100644 --- a/routers/router/api/v1/productpipeline/productpipeline.go +++ b/routers/router/api/v1/productpipeline/productpipeline.go @@ -149,7 +149,6 @@ func fetchProducts(srv *sheets.Service) error { if !isPipelineProductInDatabase(databasePipelineProducts, productId) { database.DB.Create(&structs.PipelineProduct{ Id: productId, - Name: name, Votes: 0, }) } @@ -160,7 +159,7 @@ func fetchProducts(srv *sheets.Service) error { futureProducts = append(futureProducts, structs.FutureProduct{ Id: productId, Name: name, - Votes: getVotes(databasePipelineProducts, name), // votes from database + Votes: getVotes(databasePipelineProducts, productId), // votes from database Variant: productVariant, Characteristics: productCharacteristics, }) @@ -211,9 +210,9 @@ func fetchProducts(srv *sheets.Service) error { return nil } -func getVotes(pipelineProducts []structs.PipelineProduct, name string) int { +func getVotes(pipelineProducts []structs.PipelineProduct, id string) int { for _, pipelineProduct := range pipelineProducts { - if pipelineProduct.Name == name { + if pipelineProduct.Id == id { return pipelineProduct.Votes } }