sort retire
Some checks failed
release-dev / release-dev (push) Failing after 11s

This commit is contained in:
moss 2025-05-07 23:30:12 +07:00
parent d3b22ecf48
commit d43d151e75
2 changed files with 6 additions and 4 deletions

View file

@ -274,7 +274,8 @@ namespace BMA.EHR.Application.Repositories.Reports
{ {
if (retire.TypeReport == null) if (retire.TypeReport == null)
{ {
profile_retire = profile_retire.OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root)) profile_retire = profile_retire
.OrderBy(x => string.IsNullOrEmpty(x.root) ? int.MaxValue : rootOrder.ToObject<List<string>>().IndexOf(x.root))
.ThenBy(x => child1Order.ToObject<List<string>>().IndexOf(x.child1 ?? "")) .ThenBy(x => child1Order.ToObject<List<string>>().IndexOf(x.child1 ?? ""))
.ThenBy(x => child2Order.ToObject<List<string>>().IndexOf(x.child2 ?? "")) .ThenBy(x => child2Order.ToObject<List<string>>().IndexOf(x.child2 ?? ""))
.ThenBy(x => child3Order.ToObject<List<string>>().IndexOf(x.child3 ?? "")) .ThenBy(x => child3Order.ToObject<List<string>>().IndexOf(x.child3 ?? ""))

View file

@ -331,7 +331,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
} }
} }
var order = 1; var order = 1;
foreach (var profile in profiles.OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root)) foreach (var profile in profiles
.OrderBy(x => string.IsNullOrEmpty(x.root) ? int.MaxValue : rootOrder.ToObject<List<string>>().IndexOf(x.root))
.ThenBy(x => child1Order.ToObject<List<string>>().IndexOf(x.child1 ?? "")) .ThenBy(x => child1Order.ToObject<List<string>>().IndexOf(x.child1 ?? ""))
.ThenBy(x => child2Order.ToObject<List<string>>().IndexOf(x.child2 ?? "")) .ThenBy(x => child2Order.ToObject<List<string>>().IndexOf(x.child2 ?? ""))
.ThenBy(x => child3Order.ToObject<List<string>>().IndexOf(x.child3 ?? "")) .ThenBy(x => child3Order.ToObject<List<string>>().IndexOf(x.child3 ?? ""))
@ -1346,7 +1347,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
var order = 1; var order = 1;
foreach (var profile in retire.RetirementProfiles foreach (var profile in retire.RetirementProfiles
.OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root)) .OrderBy(x => string.IsNullOrEmpty(x.root) ? int.MaxValue : rootOrder.ToObject<List<string>>().IndexOf(x.root))
.ThenBy(x => child1Order.ToObject<List<string>>().IndexOf(x.child1 ?? "")) .ThenBy(x => child1Order.ToObject<List<string>>().IndexOf(x.child1 ?? ""))
.ThenBy(x => child2Order.ToObject<List<string>>().IndexOf(x.child2 ?? "")) .ThenBy(x => child2Order.ToObject<List<string>>().IndexOf(x.child2 ?? ""))
.ThenBy(x => child3Order.ToObject<List<string>>().IndexOf(x.child3 ?? "")) .ThenBy(x => child3Order.ToObject<List<string>>().IndexOf(x.child3 ?? ""))
@ -1361,7 +1362,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
order = 1; order = 1;
foreach (var profile in retire.RetirementRawProfiles foreach (var profile in retire.RetirementRawProfiles
.OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root)) .OrderBy(x => string.IsNullOrEmpty(x.root) ? int.MaxValue : rootOrder.ToObject<List<string>>().IndexOf(x.root))
.ThenBy(x => child1Order.ToObject<List<string>>().IndexOf(x.child1 ?? "")) .ThenBy(x => child1Order.ToObject<List<string>>().IndexOf(x.child1 ?? ""))
.ThenBy(x => child2Order.ToObject<List<string>>().IndexOf(x.child2 ?? "")) .ThenBy(x => child2Order.ToObject<List<string>>().IndexOf(x.child2 ?? ""))
.ThenBy(x => child3Order.ToObject<List<string>>().IndexOf(x.child3 ?? "")) .ThenBy(x => child3Order.ToObject<List<string>>().IndexOf(x.child3 ?? ""))