You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ly...@apache.org on 2024/07/08 04:28:45 UTC
(incubator-devlake) branch dev0702 updated: fix(zentao): make sure close_date must be before opened_date
This is an automated email from the ASF dual-hosted git repository.
lynwee pushed a commit to branch dev0702
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/dev0702 by this push:
new 266725a7f fix(zentao): make sure close_date must be before opened_date
266725a7f is described below
commit 266725a7f7b03f5db31e301493dea6162b7ed4aa
Author: d4x1 <15...@qq.com>
AuthorDate: Mon Jul 8 12:28:35 2024 +0800
fix(zentao): make sure close_date must be before opened_date
---
backend/plugins/zentao/tasks/bug_convertor.go | 6 ++++--
backend/plugins/zentao/tasks/story_convertor.go | 6 ++++--
backend/plugins/zentao/tasks/task_convertor.go | 6 ++++--
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/backend/plugins/zentao/tasks/bug_convertor.go b/backend/plugins/zentao/tasks/bug_convertor.go
index 5c926cee6..6a0f679b8 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 f9aea6aaa..c8b072766 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 3489b6c29..43d8b94c2 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{}