排序
This commit is contained in:
parent
922cd4beca
commit
09ddbc0005
Binary file not shown.
Binary file not shown.
@ -14,7 +14,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("YD_XinWei.Commons")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("YD_XinWei.Commons")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f9f4a53c41a5029c82bfb442fd4e2b9f2980218f")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+922cd4beca32dd7110c41a523d23b114176a3a0b")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("YD_XinWei.Commons")]
|
[assembly: System.Reflection.AssemblyProductAttribute("YD_XinWei.Commons")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("YD_XinWei.Commons")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("YD_XinWei.Commons")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
74c4dd81c8aa3b83c88922809ca51fe25d7816fdf64b1c08a9bf0d7628572ab1
|
f98fc273dcd7d743144a77bbe89c38aafb9c6660ae1cf7e7ea16bcac6dd155ec
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -19,7 +19,7 @@ namespace YD_XinWei.Api
|
|||||||
{
|
{
|
||||||
serverOptions.Limits.MaxRequestBodySize = 10485760;
|
serverOptions.Limits.MaxRequestBodySize = 10485760;
|
||||||
});
|
});
|
||||||
webBuilder.UseKestrel().UseUrls("http://*:9995");
|
webBuilder.UseKestrel().UseUrls("http://*:9994");
|
||||||
webBuilder.UseIIS();
|
webBuilder.UseIIS();
|
||||||
webBuilder.UseStartup<Startup>();
|
webBuilder.UseStartup<Startup>();
|
||||||
}).UseServiceProviderFactory(new AutofacServiceProviderFactory());
|
}).UseServiceProviderFactory(new AutofacServiceProviderFactory());
|
||||||
|
|||||||
@ -166,39 +166,44 @@ namespace YD_XinWei.Api.Services.Impl
|
|||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var projectResults = sportsTestData
|
var projectResults = sportsTestData
|
||||||
.GroupBy(x => x.CategoryValue)
|
.GroupBy(x => x.CategoryValue)
|
||||||
.Select(g => new ItemDataDto
|
.Select(g => new ItemDataDto
|
||||||
{
|
{
|
||||||
CategoryValue = g.Key,
|
CategoryValue = g.Key,
|
||||||
|
|
||||||
// 优良率计算:分数 > 80 的人数 ÷ 总人数
|
// 优良率计算:分数 > 80 的人数 ÷ 总人数
|
||||||
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),
|
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)
|
MaleRankList = (g.Where(x => x.Sex == 1)
|
||||||
.OrderByDescending(x => x.Value)
|
.OrderBy(x => g.Key == 3 ? x.Value : -x.Value) // 条件排序
|
||||||
.Take(10)
|
.Take(10)
|
||||||
.Select((x, index) => new StudentScoreRankingDto
|
.Select((x, index) => new StudentScoreRankingDto
|
||||||
{
|
{
|
||||||
Rank = index + 1,
|
Rank = index + 1,
|
||||||
StudentNo = x.StudentNo,
|
StudentNo = x.StudentNo,
|
||||||
StudentName = x.StudentName,
|
StudentName = x.StudentName,
|
||||||
Value = x.CategoryValue == 1 ? $"{x.Height}cm/{x.Weight}kg" : $"{x.Value}{((SportsTestItemType)x.CategoryValue).GetUnit()}"
|
Value = x.CategoryValue == 1 ? $"{x.Height}cm/{x.Weight}kg" : $"{x.Value}{((SportsTestItemType)x.CategoryValue).GetUnit()}"
|
||||||
}).ToList(),
|
})).ToList(),
|
||||||
|
|
||||||
|
// 女生前十名
|
||||||
|
FemaleRankList = (g.Where(x => x.Sex == 2)
|
||||||
|
.OrderBy(x => g.Key == 3 ? x.Value : -x.Value) // 条件排序
|
||||||
|
.Take(10)
|
||||||
|
.Select((x, index) => new StudentScoreRankingDto
|
||||||
|
{
|
||||||
|
Rank = index + 1,
|
||||||
|
StudentNo = x.StudentNo,
|
||||||
|
StudentName = x.StudentName,
|
||||||
|
Value = x.CategoryValue == 1 ? $"{x.Height}cm/{x.Weight}kg" : $"{x.Value}{((SportsTestItemType)x.CategoryValue).GetUnit()}"
|
||||||
|
})).ToList()
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
// 女生前十名
|
|
||||||
FemaleRankList = g.Where(x => x.Sex == 2)
|
|
||||||
.OrderByDescending(x => x.Value)
|
|
||||||
.Take(10)
|
|
||||||
.Select((x, index) => new StudentScoreRankingDto
|
|
||||||
{
|
|
||||||
Rank = index + 1,
|
|
||||||
StudentNo = x.StudentNo,
|
|
||||||
StudentName = x.StudentName,
|
|
||||||
Value = x.CategoryValue == 1 ? $"{x.Height}cm/{x.Weight}kg" : $"{x.Value}{((SportsTestItemType)x.CategoryValue).GetUnit()}"
|
|
||||||
}).ToList()
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
res.ItemDatalist = projectResults;
|
res.ItemDatalist = projectResults;
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -14,7 +14,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("YD_XinWei.Api")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("YD_XinWei.Api")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f9f4a53c41a5029c82bfb442fd4e2b9f2980218f")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+922cd4beca32dd7110c41a523d23b114176a3a0b")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("YD_XinWei.Api")]
|
[assembly: System.Reflection.AssemblyProductAttribute("YD_XinWei.Api")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("YD_XinWei.Api")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("YD_XinWei.Api")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
3ee2a4997ca5a7a114829a3edd61a9285483441b9edac8b0338989a7c9e658a8
|
7e5321acb1dd2df00cdf92241817af42b08287146feb91b5a34d93b70138def9
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user