From 941c08ca89e4a72cb02725ad2d0331cb588c5314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Sat, 20 Aug 2022 17:02:14 +0800 Subject: [PATCH] =?UTF-8?q?enhance(report):=E5=A2=9E=E5=8A=A0=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E5=BD=95=E5=85=A5=E5=9B=AD=E5=8C=BA=E7=94=B5=E9=87=8F?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/report.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/service/report.go b/service/report.go index 24ec796..efcfbfc 100644 --- a/service/report.go +++ b/service/report.go @@ -7,6 +7,7 @@ import ( "time" "github.com/google/uuid" + "github.com/shopspring/decimal" "xorm.io/builder" ) @@ -151,3 +152,8 @@ func (_ReportService) RetreiveParkSummary(rid string) (*model.ReportSummary, err } return summary, nil } + +func (_ReportService) CheckSummaryOverall(summary model.ReportSummary) bool { + var sum = decimal.Sum(summary.Critical, summary.Peak, summary.Valley) + return sum.LessThan(summary.Overall) +}