dosubot[bot] commented on issue #7911:
URL:
https://github.com/apache/incubator-devlake/issues/7911#issuecomment-2295676948
<!-- Answer -->
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:
```go
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:
```go
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
<sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/jira/tasks/issue_changelog_convertor.go)</sup><sup>[[2]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/tapd/tasks/bug_changelog_converter.go)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
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]