You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/06/21 02:12:08 UTC
[GitHub] [incubator-devlake] likyh commented on a diff in pull request #2274: Refactor collector of worklogs and remotelinks
likyh commented on code in PR #2274:
URL: https://github.com/apache/incubator-devlake/pull/2274#discussion_r902096242
##########
plugins/jira/tasks/changelog_convertor.go:
##########
@@ -123,14 +118,8 @@ func ConvertChangelogs(taskCtx core.SubTaskContext) error {
}
}
if row.Field == "status" {
- fromStatus, ok := statusMap[row.FromString]
- if ok {
- changelog.FromValue = GetStdStatus(fromStatus.StatusCategory)
- }
- toStatus, ok := statusMap[row.ToString]
- if ok {
- changelog.ToValue = GetStdStatus(toStatus.StatusCategory)
- }
+ changelog.FromValue = getStdStatus(row.FromString)
+ changelog.ToValue = getStdStatus(row.ToString)
Review Comment:
What is this change for?
##########
plugins/jira/tasks/apiv2models/issue.go:
##########
@@ -224,26 +224,30 @@ func (i *Issue) SetAllFields(raw datatypes.JSON) error {
return nil
}
-func (i Issue) ExtractEntities(connectionId uint64) ([]uint64, *models.JiraIssue, bool, []*models.JiraWorklog, []*models.JiraChangelog, []*models.JiraChangelogItem, []*models.JiraUser) {
+func (i Issue) ExtractEntities(connectionId uint64) ([]uint64, *models.JiraIssue, []*models.JiraWorklog, []*models.JiraChangelog, []*models.JiraChangelogItem, []*models.JiraUser) {
issue := i.toToolLayer(connectionId)
var worklogs []*models.JiraWorklog
var changelogs []*models.JiraChangelog
var changelogItems []*models.JiraChangelogItem
var users []*models.JiraUser
- var needCollectWorklog bool
var sprints []uint64
+
if i.Fields.Worklog != nil {
- if i.Fields.Worklog.Total > len(i.Fields.Worklog.Worklogs) {
- needCollectWorklog = true
- } else {
- for _, w := range i.Fields.Worklog.Worklogs {
- worklogs = append(worklogs, w.ToToolLayer(connectionId))
- }
+ var issueUpdated *time.Time
+ if len(i.Fields.Worklog.Worklogs) <= i.Fields.Worklog.Total {
+ issueUpdated = i.Fields.Updated.ToNullableTime()
+ }
+ for _, w := range i.Fields.Worklog.Worklogs {
+ worklogs = append(worklogs, w.ToToolLayer(connectionId, issueUpdated))
}
}
if i.Changelog != nil {
+ var issueUpdated *time.Time
+ if len(i.Changelog.Histories) < 100 {
+ issueUpdated = i.Fields.Updated.ToNullableTime()
Review Comment:
Why `issueUpdated` be saved only when there is one page of Worklogs/Changelogs?
##########
plugins/jira/tasks/apiv2models/issue.go:
##########
@@ -224,26 +224,30 @@ func (i *Issue) SetAllFields(raw datatypes.JSON) error {
return nil
}
-func (i Issue) ExtractEntities(connectionId uint64) ([]uint64, *models.JiraIssue, bool, []*models.JiraWorklog, []*models.JiraChangelog, []*models.JiraChangelogItem, []*models.JiraUser) {
+func (i Issue) ExtractEntities(connectionId uint64) ([]uint64, *models.JiraIssue, []*models.JiraWorklog, []*models.JiraChangelog, []*models.JiraChangelogItem, []*models.JiraUser) {
issue := i.toToolLayer(connectionId)
var worklogs []*models.JiraWorklog
var changelogs []*models.JiraChangelog
var changelogItems []*models.JiraChangelogItem
var users []*models.JiraUser
- var needCollectWorklog bool
var sprints []uint64
+
if i.Fields.Worklog != nil {
- if i.Fields.Worklog.Total > len(i.Fields.Worklog.Worklogs) {
- needCollectWorklog = true
Review Comment:
`needCollectWorklog` haven't been dealt before. Why?
--
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