Change episode default sorting to SeriesOrder descending

This commit is contained in:
Mbucari 2023-04-10 15:50:19 -06:00
parent 8a1b375f0d
commit af8e1cd5ef
8 changed files with 26 additions and 23 deletions

View file

@ -58,7 +58,7 @@ namespace LibationUiBase.GridView
public abstract object BackgroundBrush { get; }
public object ButtonImage => GetLiberateIcon();
public string ToolTip => GetTooltip();
internal Book Book { get; }
private Book Book { get; }
private DateTime lastBookUpdate;
private LiberatedStatus bookStatus;

View file

@ -61,16 +61,10 @@ namespace LibationUiBase.GridView
{
//Podcast episodes usually all have the same PurchaseDate and DateAdded property:
//the date that the series was added to the library. So when sorting by PurchaseDate
//and DateAdded, compare SeriesOrder instead.
//
//Note that DateAdded is not a grid column and users cannot sort by that property.
//Entries are only sorted by DateAdded as a default sorting order when no other
//sorting column has been chose. We negate the comparison so that episodes are listed
//in ascending order.
//and DateAdded, compare SeriesOrder instead..
return PropertyName switch
{
nameof(IGridEntry.PurchaseDate) => geA.SeriesOrder.CompareTo(geB.SeriesOrder),
nameof(IGridEntry.DateAdded) => geA.SeriesOrder.CompareTo(geB.SeriesOrder) * (GetSortOrder() is ListSortDirection.Descending ? 1 : -1),
nameof(IGridEntry.DateAdded) or nameof (IGridEntry.PurchaseDate) => geA.SeriesOrder.CompareTo(geB.SeriesOrder),
_ => InternalCompare(geA, geB),
};
}
@ -79,7 +73,7 @@ namespace LibationUiBase.GridView
return InternalCompare(parentA, parentB);
}
protected abstract ListSortDirection? GetSortOrder();
protected abstract ListSortDirection GetSortOrder();
private int InternalCompare(IGridEntry x, IGridEntry y)
{

View file

@ -47,7 +47,7 @@ namespace LibationUiBase.GridView
Children = children
.Select(c => new LibraryBookEntry<TStatus>(c, this))
.OrderBy(c => c.SeriesIndex)
.OrderByDescending(c => c.SeriesOrder)
.ToList<ILibraryBookEntry>();
UpdateLibraryBook(parent);