diff --git a/api/services/gameService.go b/api/services/gameService.go index 71109e0..53b7814 100644 --- a/api/services/gameService.go +++ b/api/services/gameService.go @@ -82,11 +82,22 @@ func (g gameService) Save(fileHeader *multipart.FileHeader, title string, owner log.Println(fmt.Sprintf("Error reading game url: %s", err)) //We can ignore this error because we try it again in FindByID //Maybe the deployment is not ready yet + } else { + updateGameStatus(&game) } return &game, g.repository.Save(&game) } +func updateGameStatus(game *models.Game) { + //We set the game status to Installed if we have an url + if game.Url != "" { + game.Status = shared.Status_Installed + } else { //Otherwise we set it to Installing + game.Status = shared.Status_Installing + } +} + func (g gameService) Delete(id uuid.UUID) error { //Get the game, we need the details to delete it from k8s game, err := g.repository.FindByID(id) @@ -132,6 +143,7 @@ func (g gameService) updateGameUrl(game *models.Game) { //Maybe the deployment is not ready yet } else { game.Url = url + updateGameStatus(game) //Save the changes in the database err := g.repository.Save(game) if err != nil {