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/12/18 06:26:00 UTC

(incubator-devlake) branch fix-1218 created (now 1d560137f)

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

lynwee pushed a change to branch fix-1218
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


      at 1d560137f fix(tapd): fix overflow when converting lead time minutes

This branch includes the following new commits:

     new 1d560137f fix(tapd): fix overflow when converting lead time minutes

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(tapd): fix overflow when converting lead time minutes

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

lynwee pushed a commit to branch fix-1218
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 1d560137f7851a5e41c81199ff3e189cb2e41c7e
Author: d4x1 <15...@qq.com>
AuthorDate: Wed Dec 18 14:25:44 2024 +0800

    fix(tapd): fix overflow when converting lead time minutes
---
 backend/plugins/tapd/tasks/bug_converter.go | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/backend/plugins/tapd/tasks/bug_converter.go b/backend/plugins/tapd/tasks/bug_converter.go
index 635b153dc..1ae6eaefe 100644
--- a/backend/plugins/tapd/tasks/bug_converter.go
+++ b/backend/plugins/tapd/tasks/bug_converter.go
@@ -18,6 +18,7 @@ limitations under the License.
 package tasks
 
 import (
+	"math"
 	"reflect"
 	"strconv"
 	"time"
@@ -88,8 +89,12 @@ func ConvertBug(taskCtx plugin.SubTaskContext) errors.Error {
 				results = append(results, issueAssignee)
 			}
 			if domainL.ResolutionDate != nil && domainL.CreatedDate != nil {
-				temp := uint(domainL.ResolutionDate.Sub(*domainL.CreatedDate).Minutes())
-				domainL.LeadTimeMinutes = &temp
+				durationInMinutes := domainL.ResolutionDate.Sub(*domainL.CreatedDate).Minutes()
+				// we have found some issues' ResolutionDate is earlier than CreatedDate in tapd.
+				if durationInMinutes > 0 && durationInMinutes < math.MaxUint {
+					temp := uint(durationInMinutes)
+					domainL.LeadTimeMinutes = &temp
+				}
 			}
 			boardIssue := &ticket.BoardIssue{
 				BoardId: getWorkspaceIdGen().Generate(toolL.ConnectionId, toolL.WorkspaceId),