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) +}