From 73048cda6062e076b647bed5edb0d5f1afac3cfe Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 7 Dec 2021 10:45:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B9=8B=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC=E6=95=B0=E9=87=8F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/ai_model_manage.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index c497675fb..de9d01234 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -205,12 +205,19 @@ func deleteModelByID(ctx *context.Context, id string) error { } err = models.DeleteModelById(id) if err == nil { //find a model to change new + aimodels := models.QueryModelByName(model.Name, model.RepoId) if model.New == MODEL_LATEST { - aimodels := models.QueryModelByName(model.Name, model.RepoId) if len(aimodels) > 0 { //udpate status and version count models.ModifyModelNewProperty(aimodels[0].ID, MODEL_LATEST, len(aimodels)) } + } else { + for _, tmpModel := range aimodels { + if tmpModel.New == MODEL_LATEST { + models.ModifyModelNewProperty(tmpModel.ID, MODEL_LATEST, len(aimodels)) + break + } + } } } }