You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/11/21 11:10:22 UTC

[GitHub] [incubator-devlake] likyh commented on a diff in pull request #3742: feat(dora): update logic for change lead time

likyh commented on code in PR #3742:
URL: https://github.com/apache/incubator-devlake/pull/3742#discussion_r1027878830


##########
plugins/dora/tasks/change_lead_time_calculator.go:
##########
@@ -57,66 +89,74 @@ func CalculateChangeLeadTime(taskCtx core.SubTaskContext) errors.Error {
 		Input:        cursor,
 		Convert: func(inputRow interface{}) ([]interface{}, errors.Error) {
 			pr := inputRow.(*code.PullRequest)
-			firstCommitDate, err := getFirstCommitTime(pr.Id, db)
+			firstCommit, err := getFirstCommit(pr.Id, db)
+			if err != nil {
+				return nil, err
+			}
+			projectPrMetric := &crossdomain.ProjectPrMetric{}
+			projectPrMetric.Id = pr.Id
+			projectPrMetric.ProjectName = data.Options.ProjectName
 			if err != nil {
 				return nil, err
 			}
-			if firstCommitDate != nil {
-				codingTime := int64(pr.CreatedDate.Sub(*firstCommitDate).Seconds())
+			if firstCommit != nil {
+				codingTime := int64(pr.CreatedDate.Sub(firstCommit.AuthoredDate).Seconds())
 				if codingTime/60 == 0 && codingTime%60 > 0 {

Review Comment:
   `if codingTime <= 60 {` ?



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org