You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by gi...@apache.org on 2024/07/08 04:38:36 UTC

(incubator-devlake) branch release-v1.0-auto-cherry-pick-7699 created (now 3e7802665)

This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a change to branch release-v1.0-auto-cherry-pick-7699
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


      at 3e7802665 fix(zentao): make sure close_date must be before opened_date (#7699)

This branch includes the following new commits:

     new 3e7802665 fix(zentao): make sure close_date must be before opened_date (#7699)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(incubator-devlake) 01/01: fix(zentao): make sure close_date must be before opened_date (#7699)

Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch release-v1.0-auto-cherry-pick-7699
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 3e780266520c37d0918cbf0b17aa810c8d0ccbe6
Author: Lynwee <li...@merico.dev>
AuthorDate: Mon Jul 8 12:38:11 2024 +0800

    fix(zentao): make sure close_date must be before opened_date (#7699)
---
 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{}