diff --git a/VOL.Business/Services/Norm/N_SportsTestResultService.cs b/VOL.Business/Services/Norm/N_SportsTestResultService.cs index e5a6db5..aa5e6f1 100644 --- a/VOL.Business/Services/Norm/N_SportsTestResultService.cs +++ b/VOL.Business/Services/Norm/N_SportsTestResultService.cs @@ -623,7 +623,7 @@ namespace VOL.Business.Services var categoryMaleTotal = g.Count(x => x.Sex == SexType.Male); var categoryFemaleTotal = g.Count(x => x.Sex == SexType.Female); - int sumRate = 0, sumMaleRate = 0, sumFemaleRate = 0; + int sumRate = 0; var tempStats = new List(); @@ -634,11 +634,19 @@ namespace VOL.Business.Services var maleCount = g.Count(x => x.Sex == SexType.Male && x.Score.GetRank() == rank); var femaleCount = g.Count(x => x.Sex == SexType.Female && x.Score.GetRank() == rank); - int rate = categoryTotal == 0 ? 0 : (i < rankValues.Count - 1 - ? (int)Math.Round((double)count / categoryTotal * 100) - : 100 - sumRate); + int rate = 0; + if (categoryTotal > 0) + { + rate = i < rankValues.Count - 1 + ? (int)Math.Round(count * 100.0 / categoryTotal) + : 100 - sumRate; - int activityLevel = categoryTotal == 0 ? 0 : (int)Math.Round((double)categoryTotal / sportsTestResults.Count * 100); + if (i < 3) sumRate += rate; + } + + int activityLevel = categoryTotal > 0 + ? (int)Math.Round(categoryTotal * 100.0 / sportsTestResults.Count) + : 0; tempStats.Add(new TestSituationsModel {