Skip to content

Commit

Permalink
fix(tapd): fix overflow when converting lead time minutes (#8244) (#8246
Browse files Browse the repository at this point in the history
)

Co-authored-by: Lynwee <[email protected]>
  • Loading branch information
github-actions[bot] and d4x1 authored Dec 18, 2024
1 parent 7beae18 commit 981f325
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions backend/plugins/tapd/tasks/bug_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ limitations under the License.
package tasks

import (
"math"
"reflect"
"strconv"
"time"
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 981f325

Please sign in to comment.