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

lynwee pushed a commit to branch fix-zentao-deadline-field
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 9b86a9fa3955c5fe32b6979bfbc00190fabb0810
Author: d4x1 <[email protected]>
AuthorDate: Tue Mar 25 15:53:52 2025 +0800

    fix(zentao): fix deadline field
---
 backend/helpers/utils/field.go                 | 3 ++-
 backend/plugins/zentao/models/bug.go           | 2 +-
 backend/plugins/zentao/models/task.go          | 2 +-
 backend/plugins/zentao/tasks/bug_extractor.go  | 2 +-
 backend/plugins/zentao/tasks/task_extractor.go | 2 +-
 5 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/backend/helpers/utils/field.go b/backend/helpers/utils/field.go
index f75aa7853..c5cd56917 100644
--- a/backend/helpers/utils/field.go
+++ b/backend/helpers/utils/field.go
@@ -41,7 +41,8 @@ func GetTimeFeildFromMap(allFields map[string]interface{}, 
fieldName string, loc
        var temp time.Time
        switch v := val.(type) {
        case string:
-               if v == "" || v == "null" {
+               if v == "" || v == "null" || v == "{}" {
+                       // In Zentao, the field `deadline`'s value may be "{}".
                        return nil, nil
                }
                // If value is a string with the format yyyy-MM-dd, use loc to 
parse it
diff --git a/backend/plugins/zentao/models/bug.go 
b/backend/plugins/zentao/models/bug.go
index c44cb8f2e..54e48fb81 100644
--- a/backend/plugins/zentao/models/bug.go
+++ b/backend/plugins/zentao/models/bug.go
@@ -94,7 +94,7 @@ type ZentaoBugRes struct {
        OpenedBuild    string                 `json:"openedBuild"`
        AssignedTo     *ApiAccount            `json:"assignedTo"`
        AssignedDate   *common.Iso8601Time    `json:"assignedDate"`
-       Deadline       *common.CSTTime        `json:"deadline"`
+       Deadline       interface{}            `json:"deadline"`
        ResolvedBy     *ApiAccount            `json:"resolvedBy"`
        Resolution     string                 `json:"resolution"`
        ResolvedBuild  string                 `json:"resolvedBuild"`
diff --git a/backend/plugins/zentao/models/task.go 
b/backend/plugins/zentao/models/task.go
index 34b5d8b9f..815a4db2a 100644
--- a/backend/plugins/zentao/models/task.go
+++ b/backend/plugins/zentao/models/task.go
@@ -45,7 +45,7 @@ type ZentaoTaskRes struct {
        Estimate       float64                `json:"estimate"`
        Consumed       float64                `json:"consumed"`
        Left           float64                `json:"left"`
-       Deadline       *common.CSTTime        `json:"deadline"`
+       Deadline       interface{}            `json:"deadline"`
        Status         string                 `json:"status"`
        SubStatus      string                 `json:"subStatus"`
        Color          string                 `json:"color"`
diff --git a/backend/plugins/zentao/tasks/bug_extractor.go 
b/backend/plugins/zentao/tasks/bug_extractor.go
index b71cf5172..9ae9ee170 100644
--- a/backend/plugins/zentao/tasks/bug_extractor.go
+++ b/backend/plugins/zentao/tasks/bug_extractor.go
@@ -104,7 +104,7 @@ func ExtractBug(taskCtx plugin.SubTaskContext) errors.Error 
{
                                AssignedToId:   
data.AccountCache.getAccountIDFromApiAccount(res.AssignedTo),
                                AssignedToName: 
data.AccountCache.getAccountNameFromApiAccount(res.AssignedTo),
                                AssignedDate:   res.AssignedDate,
-                               Deadline:       res.Deadline,
+                               Deadline:       nil,
                                ResolvedById:   
data.AccountCache.getAccountIDFromApiAccount(res.ResolvedBy),
                                Resolution:     res.Resolution,
                                ResolvedBuild:  res.ResolvedBuild,
diff --git a/backend/plugins/zentao/tasks/task_extractor.go 
b/backend/plugins/zentao/tasks/task_extractor.go
index c18ed644b..be24611f9 100644
--- a/backend/plugins/zentao/tasks/task_extractor.go
+++ b/backend/plugins/zentao/tasks/task_extractor.go
@@ -116,7 +116,7 @@ func (c *taskExtractor) toZentaoTasks(accountCache 
*AccountCache, res *models.Ze
                Estimate:           res.Estimate,
                Consumed:           res.Consumed,
                Left:               res.Left,
-               Deadline:           res.Deadline,
+               Deadline:           nil,
                Status:             res.Status,
                SubStatus:          res.SubStatus,
                Color:              res.Color,

Reply via email to