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

lynwee 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 258a7e482 fix(tapd): fix json unmarshal error (#6379)
258a7e482 is described below

commit 258a7e4826104a41035262a60b39a94e22d0327a
Author: Lynwee <[email protected]>
AuthorDate: Wed Nov 1 17:40:12 2023 +0800

    fix(tapd): fix json unmarshal error (#6379)
---
 .../plugins/tapd/tasks/story_status_last_step_enricher.go  | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/backend/plugins/tapd/tasks/story_status_last_step_enricher.go 
b/backend/plugins/tapd/tasks/story_status_last_step_enricher.go
index acc6cda13..8e2429a15 100644
--- a/backend/plugins/tapd/tasks/story_status_last_step_enricher.go
+++ b/backend/plugins/tapd/tasks/story_status_last_step_enricher.go
@@ -43,7 +43,9 @@ func EnrichStoryStatusLastStep(taskCtx plugin.SubTaskContext) 
errors.Error {
                RawDataSubTaskArgs: *rawDataSubTaskArgs,
                Extract: func(row *api.RawData) ([]interface{}, errors.Error) {
                        var storyStatusLastStepRes struct {
-                               Data map[string]string
+                               Data   interface{} `json:"data"`
+                               Status int         `json:"status"`
+                               Info   string      `json:"info"`
                        }
                        err := errors.Convert(json.Unmarshal(row.Data, 
&storyStatusLastStepRes))
                        if err != nil {
@@ -60,10 +62,14 @@ func EnrichStoryStatusLastStep(taskCtx 
plugin.SubTaskContext) errors.Error {
                        }
 
                        for _, status := range statusList {
-                               if 
storyStatusLastStepRes.Data[status.EnglishName] != "" {
-                                       status.IsLastStep = true
-                                       results = append(results, status)
+                               switch storyStatusLastStepResData := 
storyStatusLastStepRes.Data.(type) {
+                               case map[string]interface{}:
+                                       if _, ok := 
storyStatusLastStepResData[status.EnglishName]; ok {
+                                               status.IsLastStep = true
+                                               results = append(results, 
status)
+                                       }
                                }
+
                        }
 
                        return results, nil

Reply via email to