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


##########
plugins/jira/tasks/issue_collector.go:
##########
@@ -55,34 +55,34 @@ func CollectIssues(taskCtx core.SubTaskContext) 
errors.Error {
        db := taskCtx.GetDal()
        data := taskCtx.GetData().(*JiraTaskData)
 
-       since := data.Since
-       incremental := false
        // user didn't specify a time range to sync, try load from database
-       if since == nil {
-               var latestUpdated models.JiraIssue
-               clauses := []dal.Clause{
-                       dal.Select("_tool_jira_issues.*"),
-                       dal.From("_tool_jira_issues"),
-                       dal.Join("LEFT JOIN _tool_jira_board_issues bi ON 
(bi.connection_id = _tool_jira_issues.connection_id AND bi.issue_id = 
_tool_jira_issues.issue_id)"),
-                       dal.Where("bi.connection_id = ? and bi.board_id = ?", 
data.Options.ConnectionId, data.Options.BoardId),
-                       dal.Orderby("_tool_jira_issues.updated DESC"),
-               }
-               err := db.First(&latestUpdated, clauses...)
-               if err != nil && !goerror.Is(err, gorm.ErrRecordNotFound) {
-                       return errors.NotFound.Wrap(err, "failed to get latest 
jira issue record")
-               }
-               if latestUpdated.IssueId > 0 {
-                       since = &latestUpdated.Updated
-                       incremental = true
-               }
+       var latestUpdated models.JiraIssue
+       clauses := []dal.Clause{
+               dal.Select("_tool_jira_issues.*"),
+               dal.From("_tool_jira_issues"),
+               dal.Join("LEFT JOIN _tool_jira_board_issues bi ON 
(bi.connection_id = _tool_jira_issues.connection_id AND bi.issue_id = 
_tool_jira_issues.issue_id)"),
+               dal.Where("bi.connection_id = ? and bi.board_id = ?", 
data.Options.ConnectionId, data.Options.BoardId),
+               dal.Orderby("_tool_jira_issues.updated DESC"),
+       }
+       err := db.First(&latestUpdated, clauses...)
+       if err != nil && !goerror.Is(err, gorm.ErrRecordNotFound) {
+               return errors.NotFound.Wrap(err, "failed to get latest jira 
issue record")
        }
        // build jql
        // IMPORTANT: we have to keep paginated data in a consistence order to 
avoid data-missing, if we sort issues by
        //  `updated`, issue will be jumping between pages if it got updated 
during the collection process
+       startFrom := data.StartFrom
+       incremental := false
        jql := "ORDER BY created ASC"
-       if since != nil {
+       if startFrom != nil {
                // prepend a time range criteria if `since` was specified, 
either by user or from database
-               jql = fmt.Sprintf("updated >= '%v' %v", 
since.Format("2006/01/02 15:04"), jql)
+               jql = fmt.Sprintf("created >= '%v' %v", 
startFrom.Format("2006/01/02 15:04"), jql)

Review Comment:
   Emm, the old line is not deleted, and now it is in Line#84.



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