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

warren pushed a commit to branch release-v0.15
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/release-v0.15 by this push:
     new 541905bba fix(jira): cherrypick 4245 to 0.15 (#4246)
541905bba is described below

commit 541905bbabb1d4a932a9d7dc61d9d13c0ce4919e
Author: Warren Chen <[email protected]>
AuthorDate: Sat Jan 28 17:40:27 2023 +0800

    fix(jira): cherrypick 4245 to 0.15 (#4246)
---
 plugins/jira/tasks/issue_changelog_collector.go | 2 ++
 plugins/jira/tasks/remotelink_collector.go      | 8 +++-----
 plugins/jira/tasks/worklog_collector.go         | 2 ++
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/plugins/jira/tasks/issue_changelog_collector.go 
b/plugins/jira/tasks/issue_changelog_collector.go
index 4bf46f4e9..901b00755 100644
--- a/plugins/jira/tasks/issue_changelog_collector.go
+++ b/plugins/jira/tasks/issue_changelog_collector.go
@@ -75,6 +75,8 @@ func CollectIssueChangelogs(taskCtx core.SubTaskContext) 
errors.Error {
        }
        incremental := collectorWithState.IsIncremental()
        if incremental {
+               clauses = append(clauses, dal.Having("i.updated > ? AND 
(i.updated > max(c.issue_updated) OR (max(c.issue_updated) IS NULL AND 
COUNT(c.changelog_id) > 0))", 
collectorWithState.LatestState.LatestSuccessStart))
+       } else {
                clauses = append(clauses, dal.Having("i.updated > 
max(c.issue_updated) OR  (max(c.issue_updated) IS NULL AND 
COUNT(c.changelog_id) > 0)"))
        }
 
diff --git a/plugins/jira/tasks/remotelink_collector.go 
b/plugins/jira/tasks/remotelink_collector.go
index 504ad509b..2a44550b6 100644
--- a/plugins/jira/tasks/remotelink_collector.go
+++ b/plugins/jira/tasks/remotelink_collector.go
@@ -69,11 +69,9 @@ func CollectRemotelinks(taskCtx core.SubTaskContext) 
errors.Error {
        }
        incremental := collectorWithState.IsIncremental()
        if incremental {
-               if collectorWithState.LatestState.LatestSuccessStart != nil {
-                       clauses = append(clauses, dal.Having("i.updated > ? AND 
(i.updated > max(rl.issue_updated) OR max(rl.issue_updated) IS NULL)", 
collectorWithState.LatestState.LatestSuccessStart))
-               } else {
-                       clauses = append(clauses, dal.Having("i.updated > 
max(rl.issue_updated) OR max(rl.issue_updated) IS NULL"))
-               }
+               clauses = append(clauses, dal.Having("i.updated > ? AND 
(i.updated > max(rl.issue_updated) OR max(rl.issue_updated) IS NULL)", 
collectorWithState.LatestState.LatestSuccessStart))
+       } else {
+               clauses = append(clauses, dal.Having("i.updated > 
max(rl.issue_updated) OR max(rl.issue_updated) IS NULL "))
        }
        cursor, err := db.Cursor(clauses...)
        if err != nil {
diff --git a/plugins/jira/tasks/worklog_collector.go 
b/plugins/jira/tasks/worklog_collector.go
index fc3d84392..1d07369ca 100644
--- a/plugins/jira/tasks/worklog_collector.go
+++ b/plugins/jira/tasks/worklog_collector.go
@@ -68,6 +68,8 @@ func CollectWorklogs(taskCtx core.SubTaskContext) 
errors.Error {
        }
        incremental := collectorWithState.IsIncremental()
        if incremental {
+               clauses = append(clauses, dal.Having("i.updated > ? AND 
(i.updated > max(wl.issue_updated) OR (max(wl.issue_updated) IS NULL AND 
COUNT(wl.worklog_id) > 0))", collectorWithState.LatestState.LatestSuccessStart))
+       } else {
                clauses = append(clauses, dal.Having("i.updated > 
max(wl.issue_updated) OR  (max(wl.issue_updated) IS NULL AND 
COUNT(wl.worklog_id) > 0)"))
        }
 

Reply via email to