Skip to content

Commit

Permalink
Merge pull request #479 from actiontech/temporarily-fix-panic
Browse files Browse the repository at this point in the history
avoid panic by commenting out codes that need confirm with PO
  • Loading branch information
ColdWaterLW authored Sep 23, 2022
2 parents 376faf0 + 27ab9b1 commit 2d2224f
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions sqle/api/controller/v1/statistic_ee.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,44 +100,44 @@ func getWorkflowDurationOfWaitingForAuditV1(c echo.Context) error {
}

func getWorkflowDurationOfWaitingForExecutionV1(c echo.Context) error {
s := model.GetStorage()

// 获取所有最后一位审核人审核通过的WorkStep
allStepsHasAudit, err := getAllFinalAuditedPassWorkStepBO(s)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}

// 获取所有上线成功的WorkStep
allStepsHasOnline, err := getAllExecutedSuccessWorkStepBO(s)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}

var durationMin float64
var count int
for _, stepsHasOnline := range allStepsHasOnline {
for _, stepsHasAudit := range allStepsHasAudit {
if stepsHasAudit.WorkflowId == stepsHasOnline.WorkflowId {
count++
durationMin += stepsHasOnline.OperateAt.Sub(*stepsHasAudit.OperateAt).Minutes()
}
}
}

if count == 0 {
return c.JSON(http.StatusOK, &GetWorkflowDurationOfWaitingForExecutionResV1{
BaseRes: controller.NewBaseReq(nil),
Data: &WorkflowStageDuration{Minutes: 0},
})
}

averageOnlineMin := int(durationMin) / count
//s := model.GetStorage()
//
//// 获取所有最后一位审核人审核通过的WorkStep
//allStepsHasAudit, err := getAllFinalAuditedPassWorkStepBO(s)
//if err != nil {
// return controller.JSONBaseErrorReq(c, err)
//}
//
//// 获取所有上线成功的WorkStep
//allStepsHasOnline, err := getAllExecutedSuccessWorkStepBO(s)
//if err != nil {
// return controller.JSONBaseErrorReq(c, err)
//}
//
//var durationMin float64
//var count int
//for _, stepsHasOnline := range allStepsHasOnline {
// for _, stepsHasAudit := range allStepsHasAudit {
// if stepsHasAudit.WorkflowId == stepsHasOnline.WorkflowId {
// count++
// durationMin += stepsHasOnline.OperateAt.Sub(*stepsHasAudit.OperateAt).Minutes()
// }
// }
//}
//
//if count == 0 {
// return c.JSON(http.StatusOK, &GetWorkflowDurationOfWaitingForExecutionResV1{
// BaseRes: controller.NewBaseReq(nil),
// Data: &WorkflowStageDuration{Minutes: 0},
// })
//}
//
//averageOnlineMin := int(durationMin) / count

return c.JSON(http.StatusOK, &GetWorkflowDurationOfWaitingForExecutionResV1{
BaseRes: controller.NewBaseReq(nil),
Data: &WorkflowStageDuration{
Minutes: uint(averageOnlineMin),
Minutes: 0,
},
})
}
Expand Down

0 comments on commit 2d2224f

Please sign in to comment.