diff --git a/backend/plugins/zentao/tasks/bug_convertor.go b/backend/plugins/zentao/tasks/bug_convertor.go index 5c926cee63b..6a0f679b8a5 100644 --- a/backend/plugins/zentao/tasks/bug_convertor.go +++ b/backend/plugins/zentao/tasks/bug_convertor.go @@ -105,8 +105,10 @@ func ConvertBug(taskCtx plugin.SubTaskContext) errors.Error { if toolEntity.AssignedToId != 0 { domainEntity.AssigneeId = accountIdGen.Generate(data.Options.ConnectionId, toolEntity.AssignedToId) } - if toolEntity.ClosedDate != nil { - temp := uint(toolEntity.ClosedDate.ToNullableTime().Sub(toolEntity.OpenedDate.ToTime()).Minutes()) + closedDate := toolEntity.ClosedDate + openedDate := toolEntity.OpenedDate + if closedDate != nil && closedDate.ToTime().After(openedDate.ToTime()) { + temp := uint(closedDate.ToNullableTime().Sub(openedDate.ToTime()).Minutes()) domainEntity.LeadTimeMinutes = &temp } var results []interface{} diff --git a/backend/plugins/zentao/tasks/story_convertor.go b/backend/plugins/zentao/tasks/story_convertor.go index f9aea6aaafe..c8b072766eb 100644 --- a/backend/plugins/zentao/tasks/story_convertor.go +++ b/backend/plugins/zentao/tasks/story_convertor.go @@ -117,8 +117,10 @@ func ConvertStory(taskCtx plugin.SubTaskContext) errors.Error { results = append(results, issueAssignee) } - if toolEntity.ClosedDate != nil { - temp := uint(toolEntity.ClosedDate.ToNullableTime().Sub(toolEntity.OpenedDate.ToTime()).Minutes()) + closedDate := toolEntity.ClosedDate + openedDate := toolEntity.OpenedDate + if closedDate != nil && closedDate.ToTime().After(openedDate.ToTime()) { + temp := uint(closedDate.ToNullableTime().Sub(openedDate.ToTime()).Minutes()) domainEntity.LeadTimeMinutes = &temp } diff --git a/backend/plugins/zentao/tasks/task_convertor.go b/backend/plugins/zentao/tasks/task_convertor.go index 3489b6c29fe..43d8b94c280 100644 --- a/backend/plugins/zentao/tasks/task_convertor.go +++ b/backend/plugins/zentao/tasks/task_convertor.go @@ -108,8 +108,10 @@ func ConvertTask(taskCtx plugin.SubTaskContext) errors.Error { if toolEntity.AssignedToId != 0 { domainEntity.AssigneeId = accountIdGen.Generate(data.Options.ConnectionId, toolEntity.AssignedToId) } - if toolEntity.ClosedDate != nil { - temp := uint(toolEntity.ClosedDate.ToNullableTime().Sub(toolEntity.OpenedDate.ToTime()).Minutes()) + closedDate := toolEntity.ClosedDate + openedDate := toolEntity.OpenedDate + if closedDate != nil && closedDate.ToTime().After(openedDate.ToTime()) { + temp := uint(closedDate.ToNullableTime().Sub(openedDate.ToTime()).Minutes()) domainEntity.LeadTimeMinutes = &temp } var results []interface{}