From 27ab9b1513144d3ef9cee972dd22ec81d1dd8f8a Mon Sep 17 00:00:00 2001 From: luowei Date: Fri, 23 Sep 2022 18:02:59 +0800 Subject: [PATCH] avoid panic by commenting out codes that need confirm with PO --- sqle/api/controller/v1/statistic_ee.go | 68 +++++++++++++------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/sqle/api/controller/v1/statistic_ee.go b/sqle/api/controller/v1/statistic_ee.go index c8e17f5c89..cbbd225257 100644 --- a/sqle/api/controller/v1/statistic_ee.go +++ b/sqle/api/controller/v1/statistic_ee.go @@ -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, }, }) }