From 79db3cd44413a787635961978f76eb6490197d84 Mon Sep 17 00:00:00 2001 From: tzwang Date: Mon, 20 May 2024 11:06:19 +0800 Subject: [PATCH] fix task time bugs Former-commit-id: ea14c8fc26cce49b1151d9d2cec9500c54f3242e --- api/internal/logic/core/pagelisttasklogic.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/internal/logic/core/pagelisttasklogic.go b/api/internal/logic/core/pagelisttasklogic.go index ba0c4382..32cc2240 100644 --- a/api/internal/logic/core/pagelisttasklogic.go +++ b/api/internal/logic/core/pagelisttasklogic.go @@ -120,9 +120,14 @@ func (l *PageListTaskLogic) updateTaskStatus(tasks []*types.TaskModel, ch chan<- } if len(aiTask) == 1 { - task.Status = aiTask[0].Status + if aiTask[0].Status == constants.Completed { + task.Status = constants.Succeeded + } else { + task.Status = aiTask[0].Status + } task.StartTime = aiTask[0].StartTime task.EndTime = aiTask[0].EndTime + task.UpdatedTime = time.Now().Format(constants.Layout) tx = l.svcCtx.DbEngin.Model(task).Table("task").Where("deleted_at is null").Updates(task) if tx.Error != nil { logx.Errorf(tx.Error.Error())