@@ -19,6 +19,7 @@ package models
1919
2020import (
2121 "fmt"
22+ "github.com/spf13/cast"
2223 "strconv"
2324
2425 "github.com/apache/incubator-devlake/core/models/common"
@@ -89,12 +90,13 @@ type ZentaoProject struct {
8990 TeamCount int `json:"teamCount" mapstructure:"teamCount"`
9091 LeftTasks string `json:"leftTasks" mapstructure:"leftTasks"`
9192 //TeamMembers []interface{} `json:"teamMembers" gorm:"-"`
92- TotalEstimate float64 `json:"totalEstimate" mapstructure:"totalEstimate"`
93- TotalConsumed float64 `json:"totalConsumed" mapstructure:"totalConsumed"`
94- TotalLeft float64 `json:"totalLeft" mapstructure:"totalLeft"`
95- Progress float64 `json:"progress" mapstructure:"progress"`
96- ScopeConfigId uint64 `json:"scopeConfigId,omitempty" mapstructure:"scopeConfigId"`
93+ TotalEstimate float64 `json:"totalEstimate" mapstructure:"totalEstimate"`
94+ TotalConsumed float64 `json:"totalConsumed" mapstructure:"totalConsumed"`
95+ TotalLeft float64 `json:"totalLeft" mapstructure:"totalLeft"`
96+ Progress interface {} `json:"progress" mapstructure:"progress"`
97+ ScopeConfigId uint64 `json:"scopeConfigId,omitempty" mapstructure:"scopeConfigId"`
9798}
99+
98100type PM struct {
99101 PmId int64 `json:"id" mapstructure:"id"`
100102 PmAccount string `json:"account" mapstructure:"account"`
@@ -115,7 +117,11 @@ type Hours struct {
115117 HoursTotalReal float64 `json:"totalReal" mapstructure:"totalReal"`
116118}
117119
118- func (p * ZentaoProject ) ConvertFix () {
120+ func (p * ZentaoProject ) fixProgressField () {
121+ p .Progress = cast .ToFloat64 (p .Progress )
122+ }
123+
124+ func (p * ZentaoProject ) fixClosedByResField () {
119125 switch cb := p .ClosedByRes .(type ) {
120126 case string :
121127 p .ClosedBy = cb
@@ -127,7 +133,9 @@ func (p *ZentaoProject) ConvertFix() {
127133 }
128134 }
129135 p .ClosedByRes = p .ClosedBy
136+ }
130137
138+ func (p * ZentaoProject ) fixCanceledByResField () {
131139 switch cb := p .CanceledByRes .(type ) {
132140 case string :
133141 p .CanceledBy = cb
@@ -141,7 +149,13 @@ func (p *ZentaoProject) ConvertFix() {
141149 p .CanceledByRes = p .CanceledBy
142150}
143151
144- func (ZentaoProject ) TableName () string {
152+ func (p * ZentaoProject ) ConvertFix () {
153+ p .fixProgressField ()
154+ p .fixClosedByResField ()
155+ p .fixCanceledByResField ()
156+ }
157+
158+ func (p ZentaoProject ) TableName () string {
145159 return "_tool_zentao_projects"
146160}
147161
0 commit comments