You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "likyh (via GitHub)" <gi...@apache.org> on 2023/02/02 06:21:42 UTC

[GitHub] [incubator-devlake] likyh commented on a diff in pull request #4292: [Bitbucket] Pagination params and merged date on PRs

likyh commented on code in PR #4292:
URL: https://github.com/apache/incubator-devlake/pull/4292#discussion_r1094087851


##########
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'm not sure if the function `LEFT` can be used in both MySQL and pg. Would like confirm it?



##########
backend/plugins/bitbucket/tasks/api_common.go:
##########
@@ -65,8 +65,8 @@ func CreateRawDataSubTaskArgs(taskCtx plugin.SubTaskContext, Table string) (*api
 func GetQuery(reqData *api.RequestData) (url.Values, errors.Error) {
 	query := url.Values{}
 	query.Set("state", "all")
-	query.Set("page", fmt.Sprintf("%v", reqData.Pager.Page))
-	query.Set("pagelen", fmt.Sprintf("%v", reqData.Pager.Size))
+	query.Set("start", fmt.Sprintf("%v", reqData.Pager.Page*reqData.Pager.Size))

Review Comment:
   `reqData.Pager.Skip` = `reqData.Pager.Page*reqData.Pager.Size`
   
   Let's use `reqData.Pager.Skip` directly.



-- 
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