Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions backend/plugins/tapd/tasks/story_changelog_extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/apache/incubator-devlake/core/plugin"
"github.com/apache/incubator-devlake/helpers/pluginhelper/api"
"github.com/apache/incubator-devlake/plugins/tapd/models"
"github.com/spf13/cast"
)

var _ plugin.SubTaskEntryPoint = ExtractStoryChangelog
Expand Down Expand Up @@ -81,12 +82,13 @@ func ExtractStoryChangelog(taskCtx plugin.SubTaskContext) errors.Error {
item.ConnectionId = data.Options.ConnectionId
item.ChangelogId = storyChangelog.Id
item.Field = k
item.ValueAfterParsed = v.(string)
switch valueBeforeMap.(type) {
item.ValueAfterParsed = cast.ToString(v)
switch v := valueBeforeMap.(type) {
case map[string]interface{}:
item.ValueBeforeParsed = valueBeforeMap.(map[string]interface{})[k].(string)
value := v[k]
item.ValueBeforeParsed = cast.ToString(value)
default:
item.ValueBeforeParsed = valueBeforeMap.(string)
item.ValueBeforeParsed = cast.ToString(valueBeforeMap)
}
err = convertUnicode(&item)
if err != nil {
Expand All @@ -98,9 +100,9 @@ func ExtractStoryChangelog(taskCtx plugin.SubTaskContext) errors.Error {
item.ConnectionId = data.Options.ConnectionId
item.ChangelogId = storyChangelog.Id
item.Field = fc.Field
item.ValueAfterParsed = valueAfterMap.(string)
item.ValueAfterParsed = cast.ToString(valueAfterMap)
// as ValueAfterParsed is string, valueBeforeMap is always string
item.ValueBeforeParsed = valueBeforeMap.(string)
item.ValueBeforeParsed = cast.ToString(valueBeforeMap)
}
err = convertUnicode(&item)
if err != nil {
Expand Down
10 changes: 6 additions & 4 deletions backend/plugins/tapd/tasks/task_changelog_extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/apache/incubator-devlake/core/plugin"
"github.com/apache/incubator-devlake/helpers/pluginhelper/api"
"github.com/apache/incubator-devlake/plugins/tapd/models"
"github.com/spf13/cast"
"strings"
)

Expand Down Expand Up @@ -82,12 +83,13 @@ func ExtractTaskChangelog(taskCtx plugin.SubTaskContext) errors.Error {
item.ConnectionId = data.Options.ConnectionId
item.ChangelogId = taskChangelog.Id
item.Field = k
item.ValueAfterParsed = v.(string)
switch valueBeforeMap.(type) {
item.ValueAfterParsed = cast.ToString(v)
switch v := valueBeforeMap.(type) {
case map[string]interface{}:
item.ValueBeforeParsed = valueBeforeMap.(map[string]interface{})[k].(string)
value := v[k]
item.ValueBeforeParsed = cast.ToString(value)
default:
item.ValueBeforeParsed = valueBeforeMap.(string)
item.ValueBeforeParsed = cast.ToString(valueBeforeMap)
}
results = append(results, &item)
}
Expand Down