From 52d8f87c66eea9a7183fbabe1ad6022fc98f662a Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 19 Dec 2021 09:27:15 -0800 Subject: [PATCH] Fixed: Sorting series without a Previous Airing Closes #4809 --- frontend/src/Store/Actions/seriesIndexActions.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/frontend/src/Store/Actions/seriesIndexActions.js b/frontend/src/Store/Actions/seriesIndexActions.js index a953652b6..ffdab4bfa 100644 --- a/frontend/src/Store/Actions/seriesIndexActions.js +++ b/frontend/src/Store/Actions/seriesIndexActions.js @@ -210,6 +210,20 @@ export const defaultState = { return Number.MAX_VALUE; }, + previousAiring: function(item, direction) { + const previousAiring = item.previousAiring; + + if (previousAiring) { + return moment(previousAiring).unix(); + } + + if (direction === sortDirections.DESCENDING) { + return -Number.MAX_VALUE; + } + + return Number.MAX_VALUE; + }, + episodeProgress: function(item) { const { statistics = {} } = item;