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

warren 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 03aa75f76 fix(zentao): skip tasks if relevent id is zero (#4602)
03aa75f76 is described below

commit 03aa75f76b52e5ca0e7f414e4a92be48150e8381
Author: Warren Chen <[email protected]>
AuthorDate: Tue Mar 7 18:07:45 2023 +0800

    fix(zentao): skip tasks if relevent id is zero (#4602)
---
 backend/plugins/zentao/tasks/execution_collector.go | 3 +++
 backend/plugins/zentao/tasks/project_collector.go   | 3 +++
 backend/plugins/zentao/tasks/task_collector.go      | 3 +++
 backend/plugins/zentao/tasks/task_data.go           | 3 +++
 4 files changed, 12 insertions(+)

diff --git a/backend/plugins/zentao/tasks/execution_collector.go 
b/backend/plugins/zentao/tasks/execution_collector.go
index d6775c2c5..c9c3e123b 100644
--- a/backend/plugins/zentao/tasks/execution_collector.go
+++ b/backend/plugins/zentao/tasks/execution_collector.go
@@ -34,6 +34,9 @@ var _ plugin.SubTaskEntryPoint = CollectExecution
 
 func CollectExecution(taskCtx plugin.SubTaskContext) errors.Error {
        data := taskCtx.GetData().(*ZentaoTaskData)
+       if data.Options.ExecutionId == 0 {
+               return nil
+       }
        collector, err := api.NewApiCollector(api.ApiCollectorArgs{
                RawDataSubTaskArgs: api.RawDataSubTaskArgs{
                        Ctx: taskCtx,
diff --git a/backend/plugins/zentao/tasks/project_collector.go 
b/backend/plugins/zentao/tasks/project_collector.go
index 579075a14..d5f451258 100644
--- a/backend/plugins/zentao/tasks/project_collector.go
+++ b/backend/plugins/zentao/tasks/project_collector.go
@@ -33,6 +33,9 @@ var _ plugin.SubTaskEntryPoint = CollectProject
 
 func CollectProject(taskCtx plugin.SubTaskContext) errors.Error {
        data := taskCtx.GetData().(*ZentaoTaskData)
+       if data.Options.ProjectId == 0 {
+               return nil
+       }
        collector, err := api.NewApiCollector(api.ApiCollectorArgs{
                RawDataSubTaskArgs: api.RawDataSubTaskArgs{
                        Ctx: taskCtx,
diff --git a/backend/plugins/zentao/tasks/task_collector.go 
b/backend/plugins/zentao/tasks/task_collector.go
index cb0974989..9b7409b70 100644
--- a/backend/plugins/zentao/tasks/task_collector.go
+++ b/backend/plugins/zentao/tasks/task_collector.go
@@ -33,6 +33,9 @@ var _ plugin.SubTaskEntryPoint = CollectTask
 
 func CollectTask(taskCtx plugin.SubTaskContext) errors.Error {
        data := taskCtx.GetData().(*ZentaoTaskData)
+       if data.Options.ExecutionId == 0 {
+               return nil
+       }
        collector, err := api.NewApiCollector(api.ApiCollectorArgs{
                RawDataSubTaskArgs: api.RawDataSubTaskArgs{
                        Ctx: taskCtx,
diff --git a/backend/plugins/zentao/tasks/task_data.go 
b/backend/plugins/zentao/tasks/task_data.go
index da07c0a54..40193f672 100644
--- a/backend/plugins/zentao/tasks/task_data.go
+++ b/backend/plugins/zentao/tasks/task_data.go
@@ -57,5 +57,8 @@ func DecodeAndValidateTaskOptions(options 
map[string]interface{}) (*ZentaoOption
        if op.ConnectionId == 0 {
                return nil, fmt.Errorf("connectionId is invalid")
        }
+       if op.ProductId == 0 {
+               return nil, fmt.Errorf("please set productId")
+       }
        return &op, nil
 }

Reply via email to