You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2023/11/03 02:32:59 UTC

(incubator-devlake) branch release-v0.19 updated: fix(tapd): fix json unmarshal error (#6392)

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

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


The following commit(s) were added to refs/heads/release-v0.19 by this push:
     new e076d0f95 fix(tapd): fix json unmarshal error (#6392)
e076d0f95 is described below

commit e076d0f9511f4400345b34e41faa6712c349aef5
Author: Lynwee <li...@merico.dev>
AuthorDate: Fri Nov 3 10:32:55 2023 +0800

    fix(tapd): fix json unmarshal error (#6392)
---
 .../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