mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 08:19:38 +02:00
Fixed: Broken Title Sort on Activity Pages
This commit is contained in:
parent
7f7226e466
commit
b3553e93ab
@ -70,7 +70,7 @@ class BlacklistRow extends Component {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (name === 'movie.sortTitle') {
|
||||
if (name === 'movies.sortTitle') {
|
||||
return (
|
||||
<TableRowCell key={name}>
|
||||
<MovieTitleLink
|
||||
@ -89,7 +89,7 @@ class BlacklistRow extends Component {
|
||||
);
|
||||
}
|
||||
|
||||
if (name === 'language') {
|
||||
if (name === 'languages') {
|
||||
return (
|
||||
<TableRowCell key={name}>
|
||||
<MovieLanguage
|
||||
|
@ -94,7 +94,7 @@ class HistoryRow extends Component {
|
||||
);
|
||||
}
|
||||
|
||||
if (name === 'movie.sortTitle') {
|
||||
if (name === 'movies.sortTitle') {
|
||||
return (
|
||||
<TableRowCell key={name}>
|
||||
<MovieTitleLink
|
||||
|
@ -133,7 +133,7 @@ class QueueRow extends Component {
|
||||
);
|
||||
}
|
||||
|
||||
if (name === 'movie.sortTitle') {
|
||||
if (name === 'movies.sortTitle') {
|
||||
return (
|
||||
<TableRowCell key={name}>
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ export const defaultState = {
|
||||
|
||||
columns: [
|
||||
{
|
||||
name: 'movie.sortTitle',
|
||||
name: 'movies.sortTitle',
|
||||
label: 'Movie Title',
|
||||
isSortable: true,
|
||||
isVisible: true
|
||||
@ -39,7 +39,7 @@ export const defaultState = {
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'language',
|
||||
name: 'languages',
|
||||
label: 'Language',
|
||||
isSortable: true,
|
||||
isVisible: true
|
||||
|
@ -34,7 +34,7 @@ export const defaultState = {
|
||||
isModifiable: false
|
||||
},
|
||||
{
|
||||
name: 'movie.sortTitle',
|
||||
name: 'movies.sortTitle',
|
||||
label: 'Movie',
|
||||
isSortable: true,
|
||||
isVisible: true
|
||||
|
@ -63,7 +63,7 @@ export const defaultState = {
|
||||
isModifiable: false
|
||||
},
|
||||
{
|
||||
name: 'movie.sortTitle',
|
||||
name: 'movies.sortTitle',
|
||||
label: 'Movie',
|
||||
isSortable: true,
|
||||
isVisible: true
|
||||
|
54
src/NzbDrone.Core/Languages/LanguagesComparer.cs
Normal file
54
src/NzbDrone.Core/Languages/LanguagesComparer.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Core.Languages
|
||||
{
|
||||
public class LanguagesComparer : IComparer<List<Language>>
|
||||
{
|
||||
public int Compare(List<Language> x, List<Language> y)
|
||||
{
|
||||
if (!x.Any() && !y.Any())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!x.Any() && y.Any())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (x.Any() && !y.Any())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (x.Count() > 1 && y.Count() > 1 && x.Count() > y.Count())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (x.Count() > 1 && y.Count() > 1 && x.Count() < y.Count())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (x.Count() > 1 && y.Count() == 1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (x.Count() == 1 && y.Count() > 1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (x.Count() == 1 && y.Count() == 1)
|
||||
{
|
||||
return x.First().Name.CompareTo(y.First().Name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
using NzbDrone.Core.Languages;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Profiles;
|
||||
using NzbDrone.Core.Qualities;
|
||||
@ -92,6 +93,12 @@ private PagingResource<QueueResource> GetQueue(PagingResource<QueueResource> pag
|
||||
? fullQueue.OrderBy(q => q.Quality, _qualityComparer)
|
||||
: fullQueue.OrderByDescending(q => q.Quality, _qualityComparer);
|
||||
}
|
||||
else if (pagingSpec.SortKey == "languages")
|
||||
{
|
||||
ordered = ascending
|
||||
? fullQueue.OrderBy(q => q.Languages, new LanguagesComparer())
|
||||
: fullQueue.OrderByDescending(q => q.Languages, new LanguagesComparer());
|
||||
}
|
||||
else
|
||||
{
|
||||
ordered = ascending ? fullQueue.OrderBy(orderByFunc) : fullQueue.OrderByDescending(orderByFunc);
|
||||
@ -117,11 +124,11 @@ private PagingResource<QueueResource> GetQueue(PagingResource<QueueResource> pag
|
||||
{
|
||||
case "status":
|
||||
return q => q.Status;
|
||||
case "movie.sortTitle":
|
||||
case "movies.sortTitle":
|
||||
return q => q.Movie.SortTitle;
|
||||
case "title":
|
||||
return q => q.Title;
|
||||
case "language":
|
||||
case "languages":
|
||||
return q => q.Languages;
|
||||
case "quality":
|
||||
return q => q.Quality;
|
||||
|
Loading…
Reference in New Issue
Block a user