From 0e909906be911f375ec6ff1939f8d62af60e33f3 Mon Sep 17 00:00:00 2001 From: Hewt <109787524@qq.com> Date: Wed, 25 Mar 2026 09:46:03 +0800 Subject: [PATCH] =?UTF-8?q?OCT=E8=AE=A1=E7=AE=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Reading/Dto/ReadingCalculateViewModel.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs index e71ab5fc5..ae4150b5a 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs @@ -306,7 +306,13 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto get { var values = new[] { FirstData, SecondData, ThirdData }; - var avg = values.Where(x => x.HasValue).Select(x => x.Value).DefaultIfEmpty(0).Average(); + + var count = values.Count(x => x.HasValue); + if (count == 0) + { + return null; + } + var avg = values.Where(x => x.HasValue).Select(x => x.Value).Average(); return avg; } }