diff options
| author | Bond-009 <bond.009@outlook.com> | 2021-09-25 22:24:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-25 22:24:57 +0200 |
| commit | 8858d8e59789ee3ad7b55077900d80437ef982b5 (patch) | |
| tree | b53f72bc270c09b33ff6d5eb4e57cd902ccad4a8 /Emby.Server.Implementations/Sorting | |
| parent | 19b8bcaec43835c698a35975a748c2129c1413aa (diff) | |
| parent | 82cb6851786d4fb24952d77d869f9e9c005a960a (diff) | |
Merge branch 'master' into theorydata
Diffstat (limited to 'Emby.Server.Implementations/Sorting')
| -rw-r--r-- | Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs b/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs index 2b0ab536f..037eb170a 100644 --- a/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs +++ b/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs @@ -28,16 +28,6 @@ namespace Emby.Server.Implementations.Sorting throw new ArgumentNullException(nameof(y)); } - if (x.PremiereDate.HasValue && y.PremiereDate.HasValue) - { - var val = DateTime.Compare(x.PremiereDate.Value, y.PremiereDate.Value); - - if (val != 0) - { - // return val; - } - } - var episode1 = x as Episode; var episode2 = y as Episode; @@ -156,8 +146,14 @@ namespace Emby.Server.Implementations.Sorting { var xValue = ((x.ParentIndexNumber ?? -1) * 1000) + (x.IndexNumber ?? -1); var yValue = ((y.ParentIndexNumber ?? -1) * 1000) + (y.IndexNumber ?? -1); + var comparisonResult = xValue.CompareTo(yValue); + // If equal, compare premiere dates + if (comparisonResult == 0 && x.PremiereDate.HasValue && y.PremiereDate.HasValue) + { + comparisonResult = DateTime.Compare(x.PremiereDate.Value, y.PremiereDate.Value); + } - return xValue.CompareTo(yValue); + return comparisonResult; } /// <summary> |
