Extract OrderByTrainer

logic to order-group may be useful for later
This commit is contained in:
Kurt 2018-04-21 23:03:51 -07:00
parent f6dda90f52
commit ea227a8113

View File

@ -109,10 +109,7 @@ public static IEnumerable<PKM> OrderByOwnership(this IEnumerable<PKM> list, ITra
{
return list.InitialSortBy()
.ThenByDescending(trainer.IsOriginalHandler) // true first
.ThenBy(p => p.OT_Name)
.ThenBy(p => p.OT_Gender)
.ThenBy(p => p.TID)
.ThenBy(p => p.SID)
.OrderByTrainer()
.ThenBy(p => p.Species)
.FinalSortBy();
}
@ -154,6 +151,18 @@ private static IOrderedEnumerable<PKM> FinalSortBy(this IOrderedEnumerable<PKM>
return postSorted;
}
/// <summary>
/// Common mid-filtering grouping of PKM data according to the Original Trainer details.
/// </summary>
/// <param name="list">Output list of <see cref="PKM"/> data.</param>
private static IOrderedEnumerable<PKM> OrderByTrainer(this IOrderedEnumerable<PKM> list)
{
return list.ThenBy(p => p.OT_Name)
.ThenBy(p => p.OT_Gender)
.ThenBy(p => p.TID)
.ThenBy(p => p.SID);
}
/// <summary>
/// Gets if the current handler is the original trainer.
/// </summary>