This is an automated email from the ASF dual-hosted git repository.
abeizn 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 ecac442e0 fix: fix the error (#4427)
ecac442e0 is described below
commit ecac442e0dac0406f175198249d276ed49341690
Author: mindlesscloud <[email protected]>
AuthorDate: Wed Feb 15 21:17:06 2023 +0800
fix: fix the error (#4427)
---
.../plugins/refdiff/tasks/ref_issue_diff_calculator.go | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/backend/plugins/refdiff/tasks/ref_issue_diff_calculator.go
b/backend/plugins/refdiff/tasks/ref_issue_diff_calculator.go
index d7b943e9a..2f9f6ec3e 100644
--- a/backend/plugins/refdiff/tasks/ref_issue_diff_calculator.go
+++ b/backend/plugins/refdiff/tasks/ref_issue_diff_calculator.go
@@ -55,16 +55,19 @@ func CalculateIssuesDiff(taskCtx plugin.SubTaskContext)
errors.Error {
if err != nil {
return err
}
+ if len(pairList) == 0 {
+ return nil
+ }
// commits_diffs join refs => ref_commits_diffs, join
pull_request_issues => ref_issues_diffs
cursor, err := db.Cursor(
dal.From("commits_diffs"),
dal.Join(
- `left join (
- select pull_request_id as id, commit_sha from pull_request_commits
+ `left join (
+ select pull_request_id as id, commit_sha from pull_request_commits
left join pull_requests p on
pull_request_commits.pull_request_id = p.id
where p.base_repo_id = ?
- union
- select id, merge_commit_sha as commit_sha from
pull_requests where base_repo_id = ?) _combine_pr
+ union
+ select id, merge_commit_sha as commit_sha from
pull_requests where base_repo_id = ?) _combine_pr
on _combine_pr.commit_sha = commits_diffs.commit_sha`,
repoId, repoId),
dal.Join("left join pull_request_issues on
pull_request_issues.pull_request_id = _combine_pr.id"),
dal.Join("left join refs new_refs on new_refs.commit_sha =
commits_diffs.new_commit_sha"),
@@ -72,8 +75,8 @@ func CalculateIssuesDiff(taskCtx plugin.SubTaskContext)
errors.Error {
dal.Orderby("new_refs.id ASC"),
dal.Where("new_refs.repo_id = ? and
pull_request_issues.issue_key > 0 and (new_refs.id, old_refs.id) in ?",
repoId, pairList),
- dal.Select(`commits_diffs.new_commit_sha as new_ref_commit_sha,
commits_diffs.old_commit_sha as old_ref_commit_sha,
- pull_request_issues.issue_id as issue_id,
pull_request_issues.issue_key as issue_number,
+ dal.Select(`commits_diffs.new_commit_sha as new_ref_commit_sha,
commits_diffs.old_commit_sha as old_ref_commit_sha,
+ pull_request_issues.issue_id as issue_id,
pull_request_issues.issue_key as issue_number,
new_refs.id as new_ref_id, old_refs.id as old_ref_id`),
)
if err != nil {