This commit is contained in:
tanglong 2025-09-03 16:08:51 +08:00
parent 1dec78c921
commit 6f13ea06b7

View File

@ -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<TestSituationsModel>();
@ -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
{