You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2024/05/27 09:00:53 UTC
(incubator-devlake) branch release-v0.21 updated: fix: execution id not exist (#7520) (#7522)
This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch release-v0.21
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v0.21 by this push:
new 277b93f2c fix: execution id not exist (#7520) (#7522)
277b93f2c is described below
commit 277b93f2c0d0807e753ff54df164e5909c99205a
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Mon May 27 17:00:49 2024 +0800
fix: execution id not exist (#7520) (#7522)
Co-authored-by: abeizn <zi...@merico.dev>
---
backend/plugins/zentao/tasks/execution_collector.go | 5 +++--
.../zentao/tasks/execution_summary_dev_collector.go | 21 +++++++++++++++++++++
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/backend/plugins/zentao/tasks/execution_collector.go b/backend/plugins/zentao/tasks/execution_collector.go
index c46fb1beb..0aa20a924 100644
--- a/backend/plugins/zentao/tasks/execution_collector.go
+++ b/backend/plugins/zentao/tasks/execution_collector.go
@@ -20,11 +20,12 @@ package tasks
import (
"encoding/json"
"fmt"
+ "net/http"
+ "net/url"
+
"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/core/plugin"
"github.com/apache/incubator-devlake/helpers/pluginhelper/api"
- "net/http"
- "net/url"
)
const RAW_EXECUTION_TABLE = "zentao_api_executions"
diff --git a/backend/plugins/zentao/tasks/execution_summary_dev_collector.go b/backend/plugins/zentao/tasks/execution_summary_dev_collector.go
index 257f14ead..a520d2712 100644
--- a/backend/plugins/zentao/tasks/execution_summary_dev_collector.go
+++ b/backend/plugins/zentao/tasks/execution_summary_dev_collector.go
@@ -22,9 +22,11 @@ import (
"fmt"
"net/http"
+ "github.com/apache/incubator-devlake/core/dal"
"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/core/plugin"
"github.com/apache/incubator-devlake/helpers/pluginhelper/api"
+ "github.com/apache/incubator-devlake/plugins/zentao/models"
)
const RAW_EXECUTION_SUMMARY_DEV_TABLE = "zentao_api_execution_summary_dev"
@@ -33,6 +35,25 @@ var _ plugin.SubTaskEntryPoint = CollectExecutionSummaryDev
func CollectExecutionSummaryDev(taskCtx plugin.SubTaskContext) errors.Error {
data := taskCtx.GetData().(*ZentaoTaskData)
+ db := taskCtx.GetDal()
+
+ // load stories id from db
+ clauses := []dal.Clause{
+ dal.From(&models.ZentaoExecutionSummary{}),
+ dal.Where(
+ "project = ? AND connection_id = ?",
+ data.Options.ProjectId, data.Options.ConnectionId,
+ ),
+ }
+ count, err := db.Count(clauses...)
+ if err != nil {
+ return err
+ }
+ // if there are already data in db, skip this task
+ if count > 0 {
+ return nil
+ }
+
collector, err := api.NewApiCollector(api.ApiCollectorArgs{
RawDataSubTaskArgs: api.RawDataSubTaskArgs{
Ctx: taskCtx,