的
This commit is contained in:
parent
bbba619019
commit
7aba0b42b7
@ -126,18 +126,18 @@ namespace YD_XinWei.Api.Services.Impl
|
||||
_caching.AddObject(sportsTestDataKey, sportsTestData, 60);
|
||||
}
|
||||
|
||||
//var bestScoreData = sportsTestData
|
||||
// .GroupBy(x => x.StudentNo)
|
||||
// .Select(g => g.OrderByDescending(x => x.ScoreTime).First())
|
||||
// .ToList();
|
||||
var bestScoreData = sportsTestData
|
||||
.GroupBy(x => x.StudentNo)
|
||||
.Select(g => g.OrderByDescending(x => x.ScoreTime).First())
|
||||
.ToList();
|
||||
|
||||
var projectResults = sportsTestData
|
||||
var projectResults = bestScoreData
|
||||
.GroupBy(x => x.CategoryValue)
|
||||
.Select(g => new ItemDataDto
|
||||
{
|
||||
CategoryValue = g.Key,
|
||||
// 优良率计算:分数 > 80 的人数 ÷ 总人数
|
||||
ExcellentRate = (int)Math.Round(g.Count(x => x.Score > 80) * 100.0 / Math.Max(g.Count(), 1), MidpointRounding.AwayFromZero),
|
||||
ExcellentRate = (int)Math.Round(sportsTestData.Count(x => x.CategoryValue == g.Key && x.Score > 80) * 100.0 / Math.Max(sportsTestData.Count(x => x.CategoryValue == g.Key), 1), MidpointRounding.AwayFromZero),
|
||||
|
||||
// 男生前十名
|
||||
MaleRankList = g.Where(x => x.Sex == 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user