jrflga commented on code in PR #4292:
URL:
https://github.com/apache/incubator-devlake/pull/4292#discussion_r1094503786
##########
backend/plugins/bitbucket/tasks/pr_convertor.go:
##########
@@ -70,6 +70,17 @@ func ConvertPullRequests(taskCtx plugin.SubTaskContext)
errors.Error {
},
Convert: func(inputRow interface{}) ([]interface{},
errors.Error) {
pr := inputRow.(*models.BitbucketPullRequest)
+
+ // Getting the merge reference commit
+ mergeCommit := &models.BitbucketCommit{}
+ err = db.First(mergeCommit, dal.Where("LEFT(sha, 12) =
?", pr.MergeCommitSha))
+ if err != nil {
+ mergeCommit.CommittedDate = *pr.MergedAt
Review Comment:
That make sense. I'll change this.
##########
backend/plugins/bitbucket/tasks/pr_convertor.go:
##########
@@ -70,6 +70,17 @@ func ConvertPullRequests(taskCtx plugin.SubTaskContext)
errors.Error {
},
Convert: func(inputRow interface{}) ([]interface{},
errors.Error) {
pr := inputRow.(*models.BitbucketPullRequest)
+
+ // Getting the merge reference commit
+ mergeCommit := &models.BitbucketCommit{}
+ err = db.First(mergeCommit, dal.Where("LEFT(sha, 12) =
?", pr.MergeCommitSha))
Review Comment:
I've tested with MySQL and a PostgreSQL instance, and it worked fine.
According to the documentation, the function exists in both databases.
https://www.postgresql.org/docs/current/functions-string.html
https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_left
--
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]