You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "jrflga (via GitHub)" <gi...@apache.org> on 2023/02/02 13:03:25 UTC
[GitHub] [incubator-devlake] jrflga commented on a diff in pull request #4292: [Bitbucket] Pagination params and merged date on PRs
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: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org