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

abeizn 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 c3e5f49a1 feat(webhook): calculate `LeadTimeMinutes` if necessary 
(#7814)
c3e5f49a1 is described below

commit c3e5f49a10340f4221704a50f05891d7af6a41d2
Author: Lynwee <1507509...@qq.com>
AuthorDate: Thu Aug 1 14:31:12 2024 +0800

    feat(webhook): calculate `LeadTimeMinutes` if necessary (#7814)
    
    * feat(webhook): calculate `LeadTimeMinutes` if necessary
    
    * fix(webhook): disable SA9003
    
    * fix(webhook): fix lint errors
---
 backend/plugins/webhook/api/issues.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/backend/plugins/webhook/api/issues.go 
b/backend/plugins/webhook/api/issues.go
index 7ee19e062..88f7e859d 100644
--- a/backend/plugins/webhook/api/issues.go
+++ b/backend/plugins/webhook/api/issues.go
@@ -138,6 +138,13 @@ func PostIssue(input *plugin.ApiResourceInput) 
(*plugin.ApiResourceOutput, error
                Severity:                request.Severity,
                Component:               request.Component,
        }
+       if *domainIssue.LeadTimeMinutes == 0 {
+               if domainIssue.ResolutionDate != nil && domainIssue.CreatedDate 
!= nil {
+                       temp := 
uint(domainIssue.ResolutionDate.Sub(*domainIssue.CreatedDate).Minutes())
+                       domainIssue.LeadTimeMinutes = &temp
+               }
+       }
+       // FIXME we have no idea about how to calculate 
domainIssue.TimeRemainingMinutes and domainIssue.TimeSpentMinutes.
        if request.CreatorId != "" {
                domainIssue.CreatorId = fmt.Sprintf("%s:%d:%s", "webhook", 
connection.ID, request.CreatorId)
        }

Reply via email to