This is an automated email from the ASF dual-hosted git repository.
zhangliang2022 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new c0136b493 fix: add sprint issue (#5597)
c0136b493 is described below
commit c0136b493f511c82ea6f843ba9e410a7a62b22f9
Author: mappjzc <[email protected]>
AuthorDate: Thu Jun 29 17:33:52 2023 +0800
fix: add sprint issue (#5597)
Add Sprint Issue.
Fix Parent Issue Id.
Nddtfjiang <[email protected]>
---
backend/plugins/zentao/tasks/bug_convertor.go | 6 ++++-
backend/plugins/zentao/tasks/task_convertor.go | 32 ++++++++++++++++++++++----
2 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/backend/plugins/zentao/tasks/bug_convertor.go
b/backend/plugins/zentao/tasks/bug_convertor.go
index 4bf6fe803..200742721 100644
--- a/backend/plugins/zentao/tasks/bug_convertor.go
+++ b/backend/plugins/zentao/tasks/bug_convertor.go
@@ -80,6 +80,10 @@ func ConvertBugForOneProduct(taskCtx plugin.SubTaskContext)
errors.Error {
},
Convert: func(inputRow interface{}) ([]interface{},
errors.Error) {
toolEntity := inputRow.(*models.ZentaoBug)
+ parentIssueId := ""
+ if toolEntity.Story != 0 {
+ parentIssueId =
storyIdGen.Generate(data.Options.ConnectionId, toolEntity.Story)
+ }
domainEntity := &ticket.Issue{
DomainEntity: domainlayer.DomainEntity{
Id:
bugIdGen.Generate(toolEntity.ConnectionId, toolEntity.ID),
@@ -92,7 +96,7 @@ func ConvertBugForOneProduct(taskCtx plugin.SubTaskContext)
errors.Error {
ResolutionDate:
toolEntity.ClosedDate.ToNullableTime(),
CreatedDate:
toolEntity.OpenedDate.ToNullableTime(),
UpdatedDate:
toolEntity.LastEditedDate.ToNullableTime(),
- ParentIssueId:
storyIdGen.Generate(data.Options.ConnectionId, toolEntity.Story),
+ ParentIssueId: parentIssueId,
Priority: getPriority(toolEntity.Pri),
CreatorId:
accountIdGen.Generate(toolEntity.ConnectionId, toolEntity.OpenedById),
CreatorName: toolEntity.OpenedByName,
diff --git a/backend/plugins/zentao/tasks/task_convertor.go
b/backend/plugins/zentao/tasks/task_convertor.go
index 6ddfb9295..04de474d7 100644
--- a/backend/plugins/zentao/tasks/task_convertor.go
+++ b/backend/plugins/zentao/tasks/task_convertor.go
@@ -45,6 +45,7 @@ func ConvertTask(taskCtx plugin.SubTaskContext) errors.Error {
data := taskCtx.GetData().(*ZentaoTaskData)
db := taskCtx.GetDal()
storyIdGen := didgen.NewDomainIdGenerator(&models.ZentaoStory{})
+ bugIdGen := didgen.NewDomainIdGenerator(&models.ZentaoBug{})
boardIdGen := didgen.NewDomainIdGenerator(&models.ZentaoProject{})
executionIdGen := didgen.NewDomainIdGenerator(&models.ZentaoExecution{})
taskIdGen := didgen.NewDomainIdGenerator(&models.ZentaoTask{})
@@ -71,7 +72,10 @@ func ConvertTask(taskCtx plugin.SubTaskContext) errors.Error
{
},
Convert: func(inputRow interface{}) ([]interface{},
errors.Error) {
toolEntity := inputRow.(*models.ZentaoTask)
-
+ parentIssueId := ""
+ if toolEntity.Story != 0 {
+ parentIssueId =
storyIdGen.Generate(data.Options.ConnectionId, toolEntity.Story)
+ }
domainEntity := &ticket.Issue{
DomainEntity: domainlayer.DomainEntity{
Id:
taskIdGen.Generate(toolEntity.ConnectionId, toolEntity.ID),
@@ -85,7 +89,7 @@ func ConvertTask(taskCtx plugin.SubTaskContext) errors.Error {
ResolutionDate:
toolEntity.ClosedDate.ToNullableTime(),
CreatedDate:
toolEntity.OpenedDate.ToNullableTime(),
UpdatedDate:
toolEntity.LastEditedDate.ToNullableTime(),
- ParentIssueId:
storyIdGen.Generate(data.Options.ConnectionId, toolEntity.Parent),
+ ParentIssueId: parentIssueId,
Priority:
getPriority(toolEntity.Pri),
CreatorId:
accountIdGen.Generate(toolEntity.ConnectionId),
CreatorName:
toolEntity.OpenedByName,
@@ -116,12 +120,30 @@ func ConvertTask(taskCtx plugin.SubTaskContext)
errors.Error {
IssueId: domainEntity.Id,
}
- sprintIssue := &ticket.SprintIssue{
- SprintId:
executionIdGen.Generate(toolEntity.ConnectionId, toolEntity.Execution),
+ sprintId :=
executionIdGen.Generate(toolEntity.ConnectionId, toolEntity.Execution)
+ sprintIssueTask := &ticket.SprintIssue{
+ SprintId: sprintId,
IssueId: domainEntity.Id,
}
- results = append(results, domainEntity,
domainBoardIssue, sprintIssue)
+ results = append(results, domainEntity,
domainBoardIssue, sprintIssueTask)
+
+ if toolEntity.StoryID != 0 {
+ sprintIssueStory := &ticket.SprintIssue{
+ SprintId: sprintId,
+ IssueId:
storyIdGen.Generate(data.Options.ConnectionId, toolEntity.StoryID),
+ }
+ results = append(results, sprintIssueStory)
+ }
+
+ if toolEntity.FromBug != 0 {
+ sprintIssueBug := &ticket.SprintIssue{
+ SprintId: sprintId,
+ IssueId:
bugIdGen.Generate(data.Options.ConnectionId, toolEntity.FromBug),
+ }
+ results = append(results, sprintIssueBug)
+ }
+
return results, nil
},
})