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

warren 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 55d530299 fix: modify custom field name (#5054)
55d530299 is described below

commit 55d530299a2d91f00c1d3a85c5fa8d23ed65f05a
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Apr 27 21:09:37 2023 +0800

    fix: modify custom field name (#5054)
    
    * fix: modify custom field name
    
    * fix: panic on options.TransformationRules is nil
---
 backend/plugins/tapd/e2e/snapshot_tables/_tool_tapd_stories.csv | 2 +-
 backend/plugins/tapd/e2e/snapshot_tables/_tool_tapd_tasks.csv   | 2 +-
 backend/plugins/tapd/models/story.go                            | 6 +++---
 backend/plugins/tapd/models/task.go                             | 6 +++---
 backend/plugins/tapd/tasks/shared.go                            | 6 ++++++
 5 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/backend/plugins/tapd/e2e/snapshot_tables/_tool_tapd_stories.csv 
b/backend/plugins/tapd/e2e/snapshot_tables/_tool_tapd_stories.csv
index 5f594e68e..69ca4d527 100644
--- a/backend/plugins/tapd/e2e/snapshot_tables/_tool_tapd_stories.csv
+++ b/backend/plugins/tapd/e2e/snapshot_tables/_tool_tapd_stories.csv
@@ -1,4 +1,4 @@
-connection_id,id,workitem_type_id,name,description,workspace_id,creator,created,modified,status,owner,cc,begin,due,size,priority,developer,iteration_id,test_focus,type,source,module,version,completed,category_id,path,parent_id,children_id,ancestor_id,business_value,effort,effort_completed,exceed,remain,release_id,confidential,templated_id,created_from,feature,std_status,std_type,url,attachment_count,has_attachment,bug_id,follower,sync_type,predecessor_count,is_archived,modifier,progress_
 [...]
+connection_id,id,workitem_type_id,name,description,workspace_id,creator,created,modified,status,owner,cc,begin,due,size,priority,developer,iteration_id,test_focus,type,source,module,version,completed,category_id,path,parent_id,children_id,ancestor_id,business_value,effort,effort_completed,exceed,remain,release_id,confidential,templated_id,created_from,feature,std_status,std_type,url,attachment_count,has_attachment,bug_id,follower,sync_type,predecessor_count,is_archived,modifier,progress_
 [...]
 
1,11991001037563,11991001000026,test-11test-11test-11test-11test-11test-11test-11test-11,"<div><div><!--
 [if gte mso 9]><![endif]--><!-- [if gte mso 
9]><![endif]--></div></div><style>@font-face{font-family:""Times New 
Roman"";}@font-face{font-family:""test-11test-11"";}@font-face{font-family:""Calibri"";}p.MsoNormal{mso-style-name:test-11test-11;mso-style-parent:"""";margin:0.00px;margin-bottom:0.00px;mso-pagination:none;text-align:justify;text-justify:inter-ideograph;font-family:Calibri
 [...]
 
1,11991001037696,1146949574001000036,test-11test-11test-11test-11test-11test-11test-11test-11test-11test-11test-11test-11test-11test-11,,991,test-11test-11,2021-08-31T07:24:19.000+00:00,2021-09-03T08:13:49.000+00:00,test111test111,test-11test-11,,2021-08-31T16:00:00.000+00:00,2021-09-01T16:00:00.000+00:00,0,,,0,,技术债,,,,2021-09-03T08:13:49.000+00:00,11991001000175,11991001037696:,0,||11991001037697,11991001037696,,0,0,0,0,0,N,11991001001129,,,IN_PROGRESS,技术需求债务,https://www.tapd.cn/991/pro
 [...]
 
1,11991001037697,11991001000026,test-11test-11test-11test-11test-11test-11test-11test-11test-11test-11test-11test-11test-11test-11,"<div><div><!--
 [if gte mso 9]><![endif]--><!-- [if gte mso 
9]><![endif]--></div></div><style>@font-face{font-family:""Times New 
Roman"";}@font-face{font-family:""test-11test-11"";}@font-face{font-family:""Calibri"";}p.MsoNormal{mso-style-name:test-11test-11;mso-style-parent:"""";margin:0.00px;margin-bottom:0.00px;mso-pagination:none;text-align:justify;text-j
 [...]
diff --git a/backend/plugins/tapd/e2e/snapshot_tables/_tool_tapd_tasks.csv 
b/backend/plugins/tapd/e2e/snapshot_tables/_tool_tapd_tasks.csv
index e6a9306d9..1a9f70dbb 100644
--- a/backend/plugins/tapd/e2e/snapshot_tables/_tool_tapd_tasks.csv
+++ b/backend/plugins/tapd/e2e/snapshot_tables/_tool_tapd_tasks.csv
@@ -1,4 +1,4 @@
-connection_id,id,name,description,workspace_id,creator,created,modified,status,owner,cc,begin,due,priority,iteration_id,completed,effort,effort_completed,exceed,remain,std_status,std_type,type,story_id,progress,has_attachment,url,attachment_count,follower,created_from,predecessor_count,successor_count,release_id,label,new_story_id,custom_field_one,custom_field_two,custom_field_three,custom_field_four,custom_field_five,custom_field6,custom_field7,custom_field8,custom_field_9,custom_field_
 [...]
+connection_id,id,name,description,workspace_id,creator,created,modified,status,owner,cc,begin,due,priority,iteration_id,completed,effort,effort_completed,exceed,remain,std_status,std_type,type,story_id,progress,has_attachment,url,attachment_count,follower,created_from,predecessor_count,successor_count,release_id,label,new_story_id,custom_field_one,custom_field_two,custom_field_three,custom_field_four,custom_field_five,custom_field_six,custom_field_seven,custom_field_eight,custom_field_9,
 [...]
 
1,11991001015107,test-11test-11test-11test-11test-11test-11test-11,,991,test-11test-11,2020-11-03T09:52:00.000+00:00,2022-06-01T11:53:30.000+00:00,done,test-11test-11,,2020-11-02T16:00:00.000+00:00,2020-11-02T16:00:00.000+00:00,,0,2020-11-03T09:53:39.000+00:00,9,9,0,0,DONE,任务,TASK,11991001001301,100,,https://www.tapd.cn/991/prong/stories/view/11991001015107,0,,,0,0,0,,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
 
1,11991001015121,test-11test-11test-11test-11test-11test-11test-11test-11test-11test-11,,991,test-11test-11;,2020-11-03T10:39:57.000+00:00,2020-11-03T10:40:17.000+00:00,done,test-11test-11,,2020-11-02T16:00:00.000+00:00,2020-11-02T16:00:00.000+00:00,,0,2020-11-03T10:40:17.000+00:00,9,9,0,0,DONE,任务,TASK,0,100,,https://www.tapd.cn/991/prong/stories/view/11991001015121,0,,,0,0,0,,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
 
1,11991001015142,test-11test-11test-11test-11test-11test-11test-11,,991,test-11test-11test-11,2020-11-03T10:58:43.000+00:00,2022-06-01T11:53:30.000+00:00,done,test-11test-11test-11,,2020-11-02T16:00:00.000+00:00,2020-11-02T16:00:00.000+00:00,,0,2020-11-03T11:00:18.000+00:00,9,9,0,0,DONE,任务,TASK,11991001001301,100,,https://www.tapd.cn/991/prong/stories/view/11991001015142,0,,,0,0,0,,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
diff --git a/backend/plugins/tapd/models/story.go 
b/backend/plugins/tapd/models/story.go
index 79e7140ae..6e7d22328 100644
--- a/backend/plugins/tapd/models/story.go
+++ b/backend/plugins/tapd/models/story.go
@@ -82,9 +82,9 @@ type TapdStory struct {
        CustomFieldThree string `json:"custom_field_three" gorm:"type:text"`
        CustomFieldFour  string `json:"custom_field_four" gorm:"type:text"`
        CustomFieldFive  string `json:"custom_field_five" gorm:"type:text"`
-       CustomField6     string `json:"custom_field_six" gorm:"type:text"`
-       CustomField7     string `json:"custom_field_seven" gorm:"type:text"`
-       CustomField8     string `json:"custom_field_eight" gorm:"type:text"`
+       CustomField6     string `json:"custom_field_six" 
gorm:"type:text;column:custom_field_six"`
+       CustomField7     string `json:"custom_field_seven" 
gorm:"type:text;column:custom_field_seven"`
+       CustomField8     string `json:"custom_field_eight" 
gorm:"type:text;column:custom_field_eight"`
        CustomField9     string `json:"custom_field_9" 
gorm:"type:text;column:custom_field_9"`
        CustomField10    string `json:"custom_field_10" 
gorm:"type:text;column:custom_field_10"`
        CustomField11    string `json:"custom_field_11" 
gorm:"type:text;column:custom_field_11"`
diff --git a/backend/plugins/tapd/models/task.go 
b/backend/plugins/tapd/models/task.go
index bd9f70852..ab6e67c9d 100644
--- a/backend/plugins/tapd/models/task.go
+++ b/backend/plugins/tapd/models/task.go
@@ -64,9 +64,9 @@ type TapdTask struct {
        CustomFieldThree string `json:"custom_field_three" gorm:"type:text"`
        CustomFieldFour  string `json:"custom_field_four" gorm:"type:text"`
        CustomFieldFive  string `json:"custom_field_five" gorm:"type:text"`
-       CustomField6     string `json:"custom_field_six" gorm:"type:text"`
-       CustomField7     string `json:"custom_field_seven" gorm:"type:text"`
-       CustomField8     string `json:"custom_field_eight" gorm:"type:text"`
+       CustomField6     string `json:"custom_field_six" 
gorm:"type:text;column:custom_field_six"`
+       CustomField7     string `json:"custom_field_seven" 
gorm:"type:text;column:custom_field_seven"`
+       CustomField8     string `json:"custom_field_eight" 
gorm:"type:text;column:custom_field_eight"`
        CustomField9     string `json:"custom_field_9" 
gorm:"type:text;column:custom_field_9"`
        CustomField10    string `json:"custom_field_10" 
gorm:"type:text;column:custom_field_10"`
        CustomField11    string `json:"custom_field_11" 
gorm:"type:text;column:custom_field_11"`
diff --git a/backend/plugins/tapd/tasks/shared.go 
b/backend/plugins/tapd/tasks/shared.go
index cd86de4cc..da88880da 100644
--- a/backend/plugins/tapd/tasks/shared.go
+++ b/backend/plugins/tapd/tasks/shared.go
@@ -206,6 +206,9 @@ func getTapdTypeMappings(data *TapdTaskData, db dal.Dal, 
system string) (map[uin
 // It returns the created map.
 func getStdTypeMappings(data *TapdTaskData) map[string]string {
        stdTypeMappings := make(map[string]string)
+       if data.Options.TransformationRules == nil {
+               return stdTypeMappings
+       }
        mapping := data.Options.TransformationRules.TypeMappings
        // Map user types to standard types
        for userType, stdType := range mapping {
@@ -218,6 +221,9 @@ func getStdTypeMappings(data *TapdTaskData) 
map[string]string {
 // based on the provided TapdTaskData. It returns the created map.
 func getStatusMapping(data *TapdTaskData) map[string]string {
        stdStatusMappings := make(map[string]string)
+       if data.Options.TransformationRules == nil {
+               return stdStatusMappings
+       }
        mapping := data.Options.TransformationRules.StatusMappings
        // Map original status values to standard status values
        for userStatus, stdStatus := range mapping {

Reply via email to