This is an automated email from the ASF dual-hosted git repository.
klesh 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 d804be30 fix: fix calculateSince out empty but not nil (#3083)
d804be30 is described below
commit d804be30e0ed31ad6042b3e64d9e8516f883f0f4
Author: mappjzc <[email protected]>
AuthorDate: Thu Sep 15 19:08:23 2022 +0800
fix: fix calculateSince out empty but not nil (#3083)
With latestUpdatedIssueComt.GithubId and latestUpdatedPrComt.GithubId was
zero it will return 0.
Nddtfjiang <[email protected]>
---
plugins/github/tasks/comment_collector.go | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/plugins/github/tasks/comment_collector.go
b/plugins/github/tasks/comment_collector.go
index 058b0f48..5a1ed7fe 100644
--- a/plugins/github/tasks/comment_collector.go
+++ b/plugins/github/tasks/comment_collector.go
@@ -20,11 +20,12 @@ package tasks
import (
"encoding/json"
"fmt"
- "github.com/apache/incubator-devlake/errors"
"net/http"
"net/url"
"time"
+ "github.com/apache/incubator-devlake/errors"
+
"github.com/apache/incubator-devlake/plugins/core/dal"
"github.com/apache/incubator-devlake/plugins/helper"
@@ -105,9 +106,11 @@ var CollectApiCommentsMeta = core.SubTaskMeta{
}
func calculateSince(data *GithubTaskData, db dal.Dal) (*time.Time, bool,
errors.Error) {
- since := &time.Time{}
- incremental := false
+ var since *time.Time
var latestUpdatedIssueComt models.GithubIssueComment
+ var latestUpdatedPrComt models.GithubPrComment
+
+ incremental := false
err := db.All(
&latestUpdatedIssueComt,
dal.Join("left join _tool_github_issues on
_tool_github_issues.github_id = _tool_github_issue_comments.issue_id"),
@@ -120,7 +123,7 @@ func calculateSince(data *GithubTaskData, db dal.Dal)
(*time.Time, bool, errors.
if err != nil {
return nil, false, errors.Default.Wrap(err, "failed to get
latest github issue record")
}
- var latestUpdatedPrComt models.GithubPrComment
+
err = db.All(
&latestUpdatedPrComt,
dal.Join("left join _tool_github_pull_requests on
_tool_github_pull_requests.github_id =
_tool_github_pull_request_comments.pull_request_id"),