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 46983385a fix: update opened date and status is nil logic (#6036)
46983385a is described below

commit 46983385a4dc2c1eb333594920a25020ebed9629
Author: abeizn <[email protected]>
AuthorDate: Thu Sep 7 20:01:30 2023 +0800

    fix: update opened date and status is nil logic (#6036)
    
    * fix: opened date logic
    
    * fix: status is nil logic
    
    * fix: add e2e test
---
 backend/plugins/zentao/e2e/execution_test.go                |  2 +-
 .../zentao/e2e/raw_tables/_raw_zentao_api_executions.csv    | 13 +++++++++----
 .../zentao/e2e/snapshot_tables/_tool_zentao_executions.csv  | 10 ++++++++--
 .../zentao/e2e/snapshot_tables/execution_board_sprint.csv   | 10 ++++++++--
 .../plugins/zentao/e2e/snapshot_tables/execution_sprint.csv | 10 ++++++++--
 backend/plugins/zentao/tasks/execution_convertor.go         |  4 ++--
 6 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/backend/plugins/zentao/e2e/execution_test.go 
b/backend/plugins/zentao/e2e/execution_test.go
index 8fa7f8658..175e819c7 100644
--- a/backend/plugins/zentao/e2e/execution_test.go
+++ b/backend/plugins/zentao/e2e/execution_test.go
@@ -36,7 +36,7 @@ func TestZentaoExecutionDataFlow(t *testing.T) {
        taskData := &tasks.ZentaoTaskData{
                Options: &tasks.ZentaoOptions{
                        ConnectionId: 1,
-                       ProjectId:    1,
+                       ProjectId:    192,
                },
                ApiClient: getFakeAPIClient(),
        }
diff --git 
a/backend/plugins/zentao/e2e/raw_tables/_raw_zentao_api_executions.csv 
b/backend/plugins/zentao/e2e/raw_tables/_raw_zentao_api_executions.csv
index 7b484146d..6164442c3 100644
--- a/backend/plugins/zentao/e2e/raw_tables/_raw_zentao_api_executions.csv
+++ b/backend/plugins/zentao/e2e/raw_tables/_raw_zentao_api_executions.csv
@@ -1,4 +1,9 @@
-id,params,data,url,input,created_at
-1,"{""ConnectionId"":1,""ProjectId"":1}","{""id"":12,""project"":1,""model"":"""",""type"":""sprint"",""lifetime"":""short"",""budget"":""0"",""budgetUnit"":""CNY"",""attribute"":"""",""percent"":0,""milestone"":""0"",""output"":"""",""auth"":"""",""parent"":1091,""path"":"",1091,12,"",""grade"":1,""name"":""TR5"",""code"":""0.1.3"",""begin"":""2022-11-01"",""end"":""2022-11-03"",""realBegan"":""2022-07-07"",""realEnd"":null,""days"":"""",""status"":""done"",""subStatus"":"""",""pri"":""
 [...]
-2,"{""ConnectionId"":1,""ProjectId"":1}","{""id"":1,""project"":1,""model"":"""",""type"":""sprint"",""lifetime"":""short"",""budget"":""0"",""budgetUnit"":""CNY"",""attribute"":"""",""percent"":0,""milestone"":""0"",""output"":"""",""auth"":"""",""parent"":7,""path"":"",7,1,"",""grade"":1,""name"":""\u4f01\u4e1a\u7f51\u7ad9\u7b2c\u4e00\u671f"",""code"":""coWeb1"",""begin"":""2022-05-01"",""end"":""2022-06-01"",""realBegan"":null,""realEnd"":null,""days"":20,""status"":""doing"",""subSta
 [...]
-3,"{""ConnectionId"":2,""ProjectId"":1}","{""id"":11,""project"":1,""model"":"""",""type"":""sprint"",""lifetime"":""short"",""budget"":""0"",""budgetUnit"":""CNY"",""attribute"":"""",""percent"":0,""milestone"":""0"",""output"":"""",""auth"":"""",""parent"":7,""path"":"",7,1,"",""grade"":1,""name"":""\u4f01\u4e1a\u7f51\u7ad9\u7b2c\u4e00\u671f"",""code"":""coWeb1"",""begin"":""2022-05-01"",""end"":""2022-06-01"",""realBegan"":null,""realEnd"":null,""days"":20,""status"":""doing"",""subSt
 [...]
+"id","params","data","url","input","created_at"
+1,"{""ConnectionId"":1,""ProjectId"":192}","{""id"":193,""project"":192,""model"":"""",""type"":""sprint"",""lifetime"":""short"",""budget"":""0"",""budgetUnit"":""CNY"",""attribute"":"""",""percent"":0,""milestone"":""0"",""output"":"""",""auth"":"""",""parent"":192,""path"":"",192,193,"",""grade"":1,""name"":""\u4e3a\u957f\u671f\u9879\u76ee\u521b\u5efa\u4e00\u4e2a\u8fed\u4ee3"",""code"":"""",""hasProduct"":0,""begin"":""2023-08-28"",""end"":""2023-09-08"",""realBegan"":""2023-08-28"","
 [...]
+2,"{""ConnectionId"":1,""ProjectId"":192}","{""id"":194,""project"":192,""model"":"""",""type"":""sprint"",""lifetime"":""short"",""budget"":""0"",""budgetUnit"":""CNY"",""attribute"":"""",""percent"":0,""milestone"":""0"",""output"":"""",""auth"":"""",""parent"":192,""path"":"",192,194,"",""grade"":1,""name"":""\u65b0\u5efa\u4e00\u4e2a\u8fed\u4ee3\uff0c\u5b8c\u6210\u4e4b\u540e\u68c0\u67e5sprints\u8868"",""code"":"""",""hasProduct"":0,""begin"":""2023-08-30"",""end"":""2023-09-05"",""rea
 [...]
+3,"{""ConnectionId"":1,""ProjectId"":192}","{""id"":270,""project"":192,""model"":"""",""type"":""sprint"",""lifetime"":""short"",""budget"":""0"",""budgetUnit"":""CNY"",""attribute"":"""",""percent"":0,""milestone"":""0"",""output"":"""",""auth"":"""",""parent"":192,""path"":"",192,270,"",""grade"":1,""name"":""\u6d41\u7a0b\u626d\u8f6c--\u6302\u8d77\u8fed\u4ee32"",""code"":"""",""hasProduct"":0,""begin"":""2023-09-07"",""end"":""2023-09-20"",""realBegan"":""2023-09-07"",""realEnd"":null
 [...]
+4,"{""ConnectionId"":1,""ProjectId"":192}","{""id"":266,""project"":192,""model"":"""",""type"":""sprint"",""lifetime"":""short"",""budget"":""0"",""budgetUnit"":""CNY"",""attribute"":"""",""percent"":0,""milestone"":""0"",""output"":"""",""auth"":"""",""parent"":192,""path"":"",192,266,"",""grade"":1,""name"":""\u65b0\u5efa\u8fed\u4ee3\u7136\u540e\u5173\u95ed"",""code"":"""",""hasProduct"":0,""begin"":""2023-09-07"",""end"":""2023-09-13"",""realBegan"":""2023-09-07"",""realEnd"":""2023-
 [...]
+5,"{""ConnectionId"":1,""ProjectId"":192}","{""id"":267,""project"":192,""model"":"""",""type"":""sprint"",""lifetime"":""short"",""budget"":""0"",""budgetUnit"":""CNY"",""attribute"":"""",""percent"":0,""milestone"":""0"",""output"":"""",""auth"":"""",""parent"":192,""path"":"",192,267,"",""grade"":1,""name"":""\u5efa\u4e00\u4e2a\u8ba1\u5212\u672a\u6765\u5f00\u59cb\u8fed\u4ee3"",""code"":"""",""hasProduct"":0,""begin"":""2023-09-09"",""end"":""2023-09-22"",""realBegan"":null,""realEnd""
 [...]
+6,"{""ConnectionId"":1,""ProjectId"":192}","{""id"":268,""project"":192,""model"":"""",""type"":""sprint"",""lifetime"":""short"",""budget"":""0"",""budgetUnit"":""CNY"",""attribute"":"""",""percent"":0,""milestone"":""0"",""output"":"""",""auth"":"""",""parent"":192,""path"":"",192,268,"",""grade"":1,""name"":""\u8d77\u59cb-\u622a\u6b62\u90fd\u662f\u7ed3\u675f\u65f6\u95f4"",""code"":"""",""hasProduct"":0,""begin"":""2023-09-04"",""end"":""2023-09-05"",""realBegan"":null,""realEnd"":null
 [...]
+7,"{""ConnectionId"":1,""ProjectId"":192}","{""id"":269,""project"":192,""model"":"""",""type"":""sprint"",""lifetime"":""short"",""budget"":""0"",""budgetUnit"":""CNY"",""attribute"":"""",""percent"":0,""milestone"":""0"",""output"":"""",""auth"":"""",""parent"":192,""path"":"",192,269,"",""grade"":1,""name"":""\u628a\u8fed\u4ee3\u6302\u8d77"",""code"":"""",""hasProduct"":0,""begin"":""2023-09-07"",""end"":""2023-09-20"",""realBegan"":null,""realEnd"":null,""days"":10,""status"":""suspe
 [...]
+8,"{""ConnectionId"":1,""ProjectId"":192}","{""id"":133,""project"":192,""model"":"""",""type"":""sprint"",""lifetime"":""short"",""budget"":""0"",""budgetUnit"":""CNY"",""attribute"":"""",""percent"":0,""milestone"":""0"",""output"":"""",""auth"":"""",""parent"":192,""path"":"",192,193,"",""grade"":1,""name"":""\u4e3a\u957f\u671f\u9879\u76ee\u521b\u5efa\u4e00\u4e2a\u8fed\u4ee3"",""code"":"""",""hasProduct"":0,""begin"":""2023-08-28"",""end"":""2023-09-08"",""realBegan"":""2023-08-28"","
 [...]
\ No newline at end of file
diff --git 
a/backend/plugins/zentao/e2e/snapshot_tables/_tool_zentao_executions.csv 
b/backend/plugins/zentao/e2e/snapshot_tables/_tool_zentao_executions.csv
index db4ccd6f4..a026ae9cb 100644
--- a/backend/plugins/zentao/e2e/snapshot_tables/_tool_zentao_executions.csv
+++ b/backend/plugins/zentao/e2e/snapshot_tables/_tool_zentao_executions.csv
@@ -1,3 +1,9 @@
 
connection_id,id,project,model,type,lifetime,budget,budget_unit,attribute,percent,milestone,output,auth,parent,path,grade,name,code,plan_begin,plan_end,real_began,real_end,status,sub_status,pri,description,version,parent_version,plan_duration,real_duration,opened_by_id,opened_date,opened_version,last_edited_by_id,last_edited_date,closed_by_id,closed_date,canceled_by_id,canceled_date,suspended_date,po_id,pm_id,qd_id,rd_id,team,acl,order_in,vision,display_cards,fluid_board,deleted,total_ho
 [...]
-1,1,1,,sprint,short,0,CNY,,0,0,,,7,",7,1,",1,企业网站第一期,coWeb1,2022-05-01T00:00:00.000+00:00,2022-06-01T00:00:00.000+00:00,,,doing,,1,开发企业网站的基本雏形。<br
 
/>,0,0,0,0,0,,,1,2022-11-21T06:00:56.000+00:00,0,,0,,,2,3,10,2,公司开发团队,open,5,rnd,0,0,0,11753,52,51.5,27.5,1,65.2,0
-1,12,1,,sprint,short,0,CNY,,0,0,,,1091,",1091,12,",1,TR5,0.1.3,2022-11-01T00:00:00.000+00:00,2022-11-03T00:00:00.000+00:00,2022-07-07T00:00:00.000+00:00,,done,,1,,0,0,24,0,6,2021-05-27T07:16:59.000+00:00,15.0.rc3,6,2022-11-15T08:22:09.000+00:00,0,,0,,,0,6,0,0,Windows组,open,5,rnd,0,1,0,0,8411,11564.5,0,1,100,0
+1,133,192,,sprint,short,0,CNY,,0,0,,,192,",192,193,",1,为长期项目创建一个迭代,,2023-08-28T00:00:00.000+00:00,2023-09-08T00:00:00.000+00:00,2023-08-28T00:00:00.000+00:00,,,,1,为长期项目创建一个迭代,0,0,0,0,1,2023-08-28T11:03:02.000+00:00,18.3,1,2023-08-28T11:03:02.000+00:00,0,,0,,,5,21,144,131,自拟团队名称,private,965,rnd,0,0,0,11520,0,2,0,192,100,0
+1,193,192,,sprint,short,0,CNY,,0,0,,,192,",192,193,",1,为长期项目创建一个迭代,,2023-08-28T00:00:00.000+00:00,2023-09-08T00:00:00.000+00:00,2023-08-28T00:00:00.000+00:00,,doing,,1,为长期项目创建一个迭代,0,0,0,0,1,2023-08-28T11:03:02.000+00:00,18.3,1,2023-08-28T11:03:02.000+00:00,0,,0,,,5,21,144,131,自拟团队名称,private,965,rnd,0,0,0,11520,0,2,0,192,100,0
+1,194,192,,sprint,short,0,CNY,,0,0,,,192,",192,194,",1,新建一个迭代,完成之后检查sprints表,,2023-08-30T00:00:00.000+00:00,2023-09-05T00:00:00.000+00:00,2023-08-29T00:00:00.000+00:00,2023-08-29T00:00:00.000+00:00,closed,,1,,0,0,0,0,1,2023-08-29T07:34:43.000+00:00,18.3,1,2023-08-29T08:04:13.000+00:00,1,2023-08-29T08:04:13.000+00:00,0,,,0,0,0,0,新建一个迭代,完成之后检查sprints表,open,970,rnd,0,0,0,5760,4,1,4,192,20,0
+1,266,192,,sprint,short,0,CNY,,0,0,,,192,",192,266,",1,新建迭代然后关闭,,2023-09-07T00:00:00.000+00:00,2023-09-13T00:00:00.000+00:00,2023-09-07T00:00:00.000+00:00,2023-09-07T00:00:00.000+00:00,closed,,1,,0,0,0,0,1,2023-09-07T01:23:21.000+00:00,18.3,1,2023-09-07T02:15:31.000+00:00,1,2023-09-07T02:15:31.000+00:00,0,,,1,31,144,145,新建迭代然后关闭,open,1330,rnd,0,0,0,5760,3,5,0,192,100,0
+1,267,192,,sprint,short,0,CNY,,0,0,,,192,",192,267,",1,建一个计划未来开始迭代,,2023-09-09T00:00:00.000+00:00,2023-09-22T00:00:00.000+00:00,,,wait,,1,,0,0,0,0,1,2023-09-07T03:36:46.000+00:00,18.3,1,2023-09-07T03:36:46.000+00:00,0,,0,,,0,0,0,0,建一个计划未来开始迭代,open,1335,rnd,0,0,0,11520,0,0,0,192,0,0
+1,268,192,,sprint,short,0,CNY,,0,0,,,192,",192,268,",1,起始-截止都是结束时间,,2023-09-04T00:00:00.000+00:00,2023-09-05T00:00:00.000+00:00,,,wait,,1,,0,0,0,0,1,2023-09-07T10:27:28.000+00:00,18.3,1,2023-09-07T10:27:28.000+00:00,0,,0,,,0,0,0,0,起始-截止都是结束时间,open,1340,rnd,0,0,0,2304,0,0,0,192,0,0
+1,269,192,,sprint,short,0,CNY,,0,0,,,192,",192,269,",1,把迭代挂起,,2023-09-07T00:00:00.000+00:00,2023-09-20T00:00:00.000+00:00,,,suspended,,1,,0,0,0,0,1,2023-09-07T10:57:47.000+00:00,18.3,1,2023-09-07T10:59:45.000+00:00,0,,0,,2023-09-07T00:00:00.000+00:00,0,0,0,0,把迭代挂起,open,1345,rnd,0,0,0,11520,0,0,0,192,0,0
+1,270,192,,sprint,short,0,CNY,,0,0,,,192,",192,270,",1,流程扭转--挂起迭代2,,2023-09-07T00:00:00.000+00:00,2023-09-20T00:00:00.000+00:00,2023-09-07T00:00:00.000+00:00,,suspended,,1,,0,0,0,0,1,2023-09-07T11:00:28.000+00:00,18.3,1,2023-09-07T11:01:14.000+00:00,0,,0,,2023-09-07T00:00:00.000+00:00,0,0,0,0,流程扭转--挂起迭代2,private,1350,rnd,0,0,0,11520,0,0,0,192,0,0
diff --git 
a/backend/plugins/zentao/e2e/snapshot_tables/execution_board_sprint.csv 
b/backend/plugins/zentao/e2e/snapshot_tables/execution_board_sprint.csv
index 4037f28c5..1d4d8be11 100644
--- a/backend/plugins/zentao/e2e/snapshot_tables/execution_board_sprint.csv
+++ b/backend/plugins/zentao/e2e/snapshot_tables/execution_board_sprint.csv
@@ -1,3 +1,9 @@
 board_id,sprint_id
-zentao:ZentaoProject:1:1,zentao:ZentaoExecution:1:1
-zentao:ZentaoProject:1:1,zentao:ZentaoExecution:1:12
+zentao:ZentaoProject:1:192,zentao:ZentaoExecution:1:133
+zentao:ZentaoProject:1:192,zentao:ZentaoExecution:1:193
+zentao:ZentaoProject:1:192,zentao:ZentaoExecution:1:194
+zentao:ZentaoProject:1:192,zentao:ZentaoExecution:1:266
+zentao:ZentaoProject:1:192,zentao:ZentaoExecution:1:267
+zentao:ZentaoProject:1:192,zentao:ZentaoExecution:1:268
+zentao:ZentaoProject:1:192,zentao:ZentaoExecution:1:269
+zentao:ZentaoProject:1:192,zentao:ZentaoExecution:1:270
diff --git a/backend/plugins/zentao/e2e/snapshot_tables/execution_sprint.csv 
b/backend/plugins/zentao/e2e/snapshot_tables/execution_sprint.csv
index 32e8e2b1b..6af3c28f4 100644
--- a/backend/plugins/zentao/e2e/snapshot_tables/execution_sprint.csv
+++ b/backend/plugins/zentao/e2e/snapshot_tables/execution_sprint.csv
@@ -1,3 +1,9 @@
 id,name,url,status,started_date,ended_date,completed_date,original_board_id
-zentao:ZentaoExecution:1:1,企业网站第一期,https://zentao.demo.haogs.cn/execution-view-1.html,ACTIVE,,2022-06-01T00:00:00.000+00:00,,zentao:ZentaoProject:1:1
-zentao:ZentaoExecution:1:12,TR5,https://zentao.demo.haogs.cn/execution-view-12.html,CLOSED,2022-07-07T00:00:00.000+00:00,2022-11-03T00:00:00.000+00:00,,zentao:ZentaoProject:1:1
+zentao:ZentaoExecution:1:133,为长期项目创建一个迭代,https://zentao.demo.haogs.cn/execution-view-133.html,,2023-08-28T00:00:00.000+00:00,2023-09-08T00:00:00.000+00:00,,zentao:ZentaoProject:1:192
+zentao:ZentaoExecution:1:193,为长期项目创建一个迭代,https://zentao.demo.haogs.cn/execution-view-193.html,ACTIVE,2023-08-28T11:03:02.000+00:00,2023-09-08T00:00:00.000+00:00,,zentao:ZentaoProject:1:192
+zentao:ZentaoExecution:1:194,新建一个迭代,完成之后检查sprints表,https://zentao.demo.haogs.cn/execution-view-194.html,CLOSED,2023-08-29T07:34:43.000+00:00,2023-09-05T00:00:00.000+00:00,2023-08-29T08:04:13.000+00:00,zentao:ZentaoProject:1:192
+zentao:ZentaoExecution:1:266,新建迭代然后关闭,https://zentao.demo.haogs.cn/execution-view-266.html,CLOSED,2023-09-07T01:23:21.000+00:00,2023-09-13T00:00:00.000+00:00,2023-09-07T02:15:31.000+00:00,zentao:ZentaoProject:1:192
+zentao:ZentaoExecution:1:267,建一个计划未来开始迭代,https://zentao.demo.haogs.cn/execution-view-267.html,FUTURE,2023-09-09T00:00:00.000+00:00,2023-09-22T00:00:00.000+00:00,,zentao:ZentaoProject:1:192
+zentao:ZentaoExecution:1:268,起始-截止都是结束时间,https://zentao.demo.haogs.cn/execution-view-268.html,FUTURE,2023-09-04T00:00:00.000+00:00,2023-09-05T00:00:00.000+00:00,,zentao:ZentaoProject:1:192
+zentao:ZentaoExecution:1:269,把迭代挂起,https://zentao.demo.haogs.cn/execution-view-269.html,SUSPENDED,2023-09-07T10:57:47.000+00:00,2023-09-20T00:00:00.000+00:00,,zentao:ZentaoProject:1:192
+zentao:ZentaoExecution:1:270,流程扭转--挂起迭代2,https://zentao.demo.haogs.cn/execution-view-270.html,SUSPENDED,2023-09-07T11:00:28.000+00:00,2023-09-20T00:00:00.000+00:00,,zentao:ZentaoProject:1:192
diff --git a/backend/plugins/zentao/tasks/execution_convertor.go 
b/backend/plugins/zentao/tasks/execution_convertor.go
index 91bb92f4f..925a2df50 100644
--- a/backend/plugins/zentao/tasks/execution_convertor.go
+++ b/backend/plugins/zentao/tasks/execution_convertor.go
@@ -98,10 +98,10 @@ func ConvertExecutions(taskCtx plugin.SubTaskContext) 
errors.Error {
                                OriginalBoardID: 
projectIdGen.Generate(toolExecution.ConnectionId, data.Options.ProjectId),
                        }
 
-                       if domainStatus == `FUTURE` {
+                       if domainStatus == `FUTURE` || domainStatus == `` {
                                sprint.StartedDate = 
toolExecution.PlanBegin.ToNullableTime()
                        } else {
-                               sprint.StartedDate = 
toolExecution.RealBegan.ToNullableTime()
+                               sprint.StartedDate = 
toolExecution.OpenedDate.ToNullableTime()
                        }
 
                        boardSprint := &ticket.BoardSprint{

Reply via email to