Update Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs

Co-authored-by: Claus Vium <cvium@users.noreply.github.com>
This commit is contained in:
Rob 2021-09-13 08:32:12 -07:00 committed by GitHub
parent 2b5f3f294e
commit 96bc24b1dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,12 +146,11 @@ namespace Emby.Server.Implementations.Sorting
{ {
var xValue = ((x.ParentIndexNumber ?? -1) * 1000) + (x.IndexNumber ?? -1); var xValue = ((x.ParentIndexNumber ?? -1) * 1000) + (x.IndexNumber ?? -1);
var yValue = ((y.ParentIndexNumber ?? -1) * 1000) + (y.IndexNumber ?? -1); var yValue = ((y.ParentIndexNumber ?? -1) * 1000) + (y.IndexNumber ?? -1);
var compare_val = xValue.CompareTo(yValue); var comparisonResult = xValue.CompareTo(yValue);
if (compare_val == 0) // If equal, compare premiere dates
if (comparisonResult == 0 && x.PremiereDate.HasValue && y.PremiereDate.HasValue)
{ {
if (x.PremiereDate.HasValue & y.PremiereDate.HasValue) comparisonResult = DateTime.Compare(x.PremiereDate.Value, y.PremiereDate.Value);
{
compare_val = DateTime.Compare(x.PremiereDate.Value, y.PremiereDate.Value);
} }
} }