This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new c1cd7189d fix(tapd): fix json unmarshal error (#6395)
c1cd7189d is described below

commit c1cd7189d7a560f8d14879db2235757d40b8726e
Author: Lynwee <[email protected]>
AuthorDate: Fri Nov 3 12:19:29 2023 +0800

    fix(tapd): fix json unmarshal error (#6395)
---
 backend/plugins/tapd/tasks/bug_status_last_step_enricher.go | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/backend/plugins/tapd/tasks/bug_status_last_step_enricher.go 
b/backend/plugins/tapd/tasks/bug_status_last_step_enricher.go
index 2cf0eddcf..ed07b6de4 100644
--- a/backend/plugins/tapd/tasks/bug_status_last_step_enricher.go
+++ b/backend/plugins/tapd/tasks/bug_status_last_step_enricher.go
@@ -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 {
@@ -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)
+                                       }
                                }
                        }
 

Reply via email to