abeizn commented on code in PR #3726:
URL: 
https://github.com/apache/incubator-devlake/pull/3726#discussion_r1021487739


##########
plugins/refdiff/tasks/ref_issue_diff_calculator.go:
##########
@@ -53,23 +53,24 @@ func CalculateIssuesDiff(taskCtx core.SubTaskContext) 
errors.Error {
                return err
        }
        cursor, err := db.Cursor(
-               dal.From("refs_commits_diffs"),
+               dal.From("commits_diffs"),
                dal.Join(
                        `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 
-                       on _combine_pr.commit_sha = 
refs_commits_diffs.commit_sha`, repoId, repoId),
+                       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 on refs.commit_sha = 
refs_commits_diffs.new_ref_commit_sha"),
-               dal.Orderby("refs_commits_diffs.new_ref_id ASC"),
-               dal.Where("refs.repo_id = ? and pull_request_issues.issue_key > 
0 and (refs_commits_diffs.new_ref_id, refs_commits_diffs.old_ref_id) in ?",
+               dal.Join("left join refs new_refs on new_refs.commit_sha = 
commits_diffs.new_commit_sha"),
+               dal.Join("left join refs old_refs on old_refs.commit_sha = 
commits_diffs.old_commit_sha"),
+               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(`refs_commits_diffs.new_ref_commit_sha as 
new_ref_commit_sha, refs_commits_diffs.old_ref_commit_sha as 
old_ref_commit_sha, 
+               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, 
-                       refs_commits_diffs.new_ref_id as new_ref_id, 
refs_commits_diffs.old_ref_id as old_ref_id`),
+                       new_refs.id as new_ref_id, old_refs.id as old_ref_id`),

Review Comment:
   ok



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to