chore: closes #21, #20

This commit is contained in:
2023-09-27 21:20:39 +01:00
parent eab788aabd
commit 194277297f
9 changed files with 465 additions and 94 deletions

View File

@@ -2,6 +2,8 @@ package models_train
import (
"net/http"
"os"
"path"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/models/utils"
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/utils"
@@ -40,11 +42,13 @@ func handleRest(handle *Handle) {
return Error500(err)
}
if model.Status != FAILED_PREPARING_TRAINING {
if model.Status != FAILED_PREPARING_TRAINING && model.Status != FAILED_TRAINING {
// TODO improve response
return ErrorCode(nil, 400, c.AddMap(nil))
}
os.RemoveAll(path.Join("savedData", model.Id, "defs"))
_, err = handle.Db.Exec("delete from model_definition where model_id=$1", model.Id)
if err != nil {
// TODO improve response