Fixed: Tag details list movies in alphabetical order

Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
pull/2/head
Qstick 5 years ago
parent e8e852100c
commit 9bdaea4a1b

@ -9,7 +9,7 @@ function findMatchingItems(ids, items) {
}); });
} }
function createMatchingMovieSelector() { function createUnorderedMatchingMoviesSelector() {
return createSelector( return createSelector(
(state, { movieIds }) => movieIds, (state, { movieIds }) => movieIds,
createAllMoviesSelector(), createAllMoviesSelector(),
@ -17,6 +17,26 @@ function createMatchingMovieSelector() {
); );
} }
function createMatchingMoviesSelector() {
return createSelector(
createUnorderedMatchingMoviesSelector(),
(movies) => {
return movies.sort((movieA, movieB) => {
const sortTitleA = movieA.sortTitle;
const sortTitleB = movieB.sortTitle;
if (sortTitleA > sortTitleB) {
return 1;
} else if (sortTitleA < sortTitleB) {
return -1;
}
return 0;
});
}
);
}
function createMatchingDelayProfilesSelector() { function createMatchingDelayProfilesSelector() {
return createSelector( return createSelector(
(state, { delayProfileIds }) => delayProfileIds, (state, { delayProfileIds }) => delayProfileIds,
@ -51,7 +71,7 @@ function createMatchingNetImportsSelector() {
function createMapStateToProps() { function createMapStateToProps() {
return createSelector( return createSelector(
createMatchingMovieSelector(), createMatchingMoviesSelector(),
createMatchingDelayProfilesSelector(), createMatchingDelayProfilesSelector(),
createMatchingNotificationsSelector(), createMatchingNotificationsSelector(),
createMatchingRestrictionsSelector(), createMatchingRestrictionsSelector(),

Loading…
Cancel
Save