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

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

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

lynwee 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 4f5abbdf6 fix(tapd): fix json unmarshal error (#6396)
4f5abbdf6 is described below

commit 4f5abbdf644637eef2e7ac858ece1897d7ad046e
Author: Lynwee <li...@merico.dev>
AuthorDate: Fri Nov 3 12:42:15 2023 +0800

    fix(tapd): fix json unmarshal error (#6396)
---
 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)
+					}
 				}
 			}