hezyin commented on code in PR #4858:
URL: 
https://github.com/apache/incubator-devlake/pull/4858#discussion_r1160106374


##########
backend/plugins/dora/tasks/change_lead_time_calculator.go:
##########
@@ -123,17 +123,18 @@ func CalculateChangeLeadTime(taskCtx 
plugin.SubTaskContext) errors.Error {
                        }
 
                        // Calculate PR cycle time
-                       projectPrMetric.PrCycleTime = nil
+                       if deployment == nil {
+                               // Return the projectPrMetric with nill cycle 
time
+                               return []interface{}{projectPrMetric}, nil
+                       }
                        var result int64
                        if projectPrMetric.PrCodingTime != nil {
                                result += *projectPrMetric.PrCodingTime
                        }
                        if prDuring != nil {
                                result += *prDuring
                        }
-                       if projectPrMetric.PrDeployTime != nil {
-                               result += *projectPrMetric.PrDeployTime
-                       }
+                       result += *projectPrMetric.PrDeployTime

Review Comment:
   @warren830 Maybe we still need the nil check on 
`projectPrMetric.PrDeployTime`? Even though we have checked `deployment` is not 
nil, but `deployment.TaskFinishedDate` might be nil on line 117.



##########
backend/plugins/dora/e2e/snapshot_tables/project_pr_metrics.csv:
##########
@@ -1,7 +1,7 @@
 
id,project_name,first_commit_sha,pr_coding_time,first_review_id,pr_pickup_time,pr_review_time,deployment_id,pr_deploy_time,pr_cycle_time
 
github:GithubPullRequest:1:1043463302,project1,75ab753225b5b8acf3bc6e40e463b54b6800e7ed,,github:GithubPrComment:1:964527893,8558,2859,task11,93134,104552
 
github:GithubPullRequest:1:1048233599,project1,4f8cdefc9a9d53af16dd482c61623312eb9e9b5e,,github:GithubPrComment:1:1239007576,194,4033,task12,76605,80833
-github:GithubPullRequest:1:1049191985,project1,4b71faf666833c0c7b915a512811e2c5e746d3de,1,github:GithubPrComment:1:965369774,156,1712,task13,115026,116896

Review Comment:
   I see. @likyh probably introduced `prDuring` so that we can calculate cycle 
time when there's no review. So there may be a 1 min difference between using 
`prDuring` vs using pr pickup time + pr review time.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to