Skip to content

Commit

Permalink
fix(zentao): make sure close_date must be before opened_date (#7699) (#…
Browse files Browse the repository at this point in the history
…7701)

Co-authored-by: Lynwee <linwei.hou@merico.dev>
  • Loading branch information
github-actions[bot] and d4x1 authored Jul 8, 2024
1 parent ca7619d commit a7fbfd6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions backend/plugins/zentao/tasks/bug_convertor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
6 changes: 4 additions & 2 deletions backend/plugins/zentao/tasks/story_convertor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 4 additions & 2 deletions backend/plugins/zentao/tasks/task_convertor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down

0 comments on commit a7fbfd6

Please sign in to comment.