incubator-devlake icon indicating copy to clipboard operation
incubator-devlake copied to clipboard

[Bug][jira] field_id is empty in issue_changelogs

Open usharerose opened this issue 1 year ago • 1 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

What happened

Jira plugin's issue_changelog_convertor doesn't fill field_id

What do you expect to happen

fill field_id value

How to reproduce

Check the data in issue_changelogs table

Anything else

No response

Version

5de490899c39b6a7e468d5ec6390b20de5e1e5b9

Are you willing to submit PR?

  • [X] Yes I am willing to submit a PR!

Code of Conduct

usharerose avatar Aug 19 '24 05:08 usharerose

The field_id is empty in the issue_changelogs table because the field_id is not being set in the Convert function of the StatefulDataConverter. The FieldId is directly assigned from row.FieldId, but row.FieldId is not being populated from the database.

Here is the relevant part of the code:

Convert: func(row *IssueChangelogItemResult) ([]interface{}, errors.Error) {
    changelog := &ticket.IssueChangelogs{
        DomainEntity: domainlayer.DomainEntity{Id: changelogIdGenerator.Generate(
            row.ConnectionId,
            row.ChangelogId,
            row.Field,
        )},
        IssueId:           issueIdGenerator.Generate(row.ConnectionId, row.IssueId),
        AuthorId:          accountIdGen.Generate(connectionId, row.AuthorAccountId),
        AuthorName:        row.AuthorDisplayName,
        FieldId:           row.FieldId,  // This is where FieldId is assigned
        FieldName:         row.Field,
        OriginalFromValue: row.FromString,
        OriginalToValue:   row.ToString,
        CreatedDate:       row.Created,
    }
    // ... rest of the code
}

The IssueChangelogItemResult struct does not include a FieldId field, which is why row.FieldId is not populated:

type IssueChangelogItemResult struct {
    models.JiraIssueChangelogItems
    IssueId           uint64 `gorm:"index"`
    AuthorAccountId   string
    AuthorDisplayName string
    Created           time.Time
}

To resolve this issue, ensure that the row.FieldId is correctly populated from the Jira data source during the extraction process [1][2].

To continue talking to Dosu, mention @dosu.

dosubot[bot] avatar Aug 19 '24 05:08 dosubot[bot]

Resloved.

abeizn avatar Sep 06 '24 09:09 abeizn