You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by gi...@apache.org on 2024/05/27 09:00:34 UTC
(incubator-devlake) branch release-v0.21-auto-cherry-pick-7520 created (now e84c1d568)
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a change to branch release-v0.21-auto-cherry-pick-7520
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
at e84c1d568 fix: execution id not exist (#7520)
This branch includes the following new commits:
new e84c1d568 fix: execution id not exist (#7520)
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(incubator-devlake) 01/01: fix: execution id not exist (#7520)
Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch release-v0.21-auto-cherry-pick-7520
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit e84c1d568eca4a595e157a8e4a25e60c65711dd8
Author: abeizn <zi...@merico.dev>
AuthorDate: Mon May 27 17:00:16 2024 +0800
fix: execution id not exist (#7520)
---
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,