Skip to content

Commit

Permalink
fix(tapd): fix json unmarshal error (apache#6395)
Browse files Browse the repository at this point in the history
  • Loading branch information
d4x1 committed Nov 3, 2023
1 parent 6cf0219 commit c1cd718
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions backend/plugins/tapd/tasks/bug_status_last_step_enricher.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ func EnrichBugStatusLastStep(taskCtx plugin.SubTaskContext) errors.Error {
RawDataSubTaskArgs: *rawDataSubTaskArgs,
Extract: func(row *api.RawData) ([]interface{}, errors.Error) {
var bugStatusLastStepRes struct {
Data map[string]string
Data interface{} `json:"data"`
Status int `json:"status"`
Info string `json:"info"`
}
err := errors.Convert(json.Unmarshal(row.Data, &bugStatusLastStepRes))
if err != nil {
Expand All @@ -60,9 +62,12 @@ func EnrichBugStatusLastStep(taskCtx plugin.SubTaskContext) errors.Error {
}

for _, status := range statusList {
if bugStatusLastStepRes.Data[status.EnglishName] != "" {
status.IsLastStep = true
results = append(results, status)
switch bugStatusLastStepResData := bugStatusLastStepRes.Data.(type) {
case map[string]interface{}:
if _, ok := bugStatusLastStepResData[status.EnglishName]; ok {
status.IsLastStep = true
results = append(results, status)
}
}
}

Expand Down

0 comments on commit c1cd718

Please sign in to comment.