mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: Broken Title Sort on Activity Pages
This commit is contained in:
@@ -70,7 +70,7 @@ class BlacklistRow extends Component {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name === 'movie.sortTitle') {
|
if (name === 'movies.sortTitle') {
|
||||||
return (
|
return (
|
||||||
<TableRowCell key={name}>
|
<TableRowCell key={name}>
|
||||||
<MovieTitleLink
|
<MovieTitleLink
|
||||||
@@ -89,7 +89,7 @@ class BlacklistRow extends Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name === 'language') {
|
if (name === 'languages') {
|
||||||
return (
|
return (
|
||||||
<TableRowCell key={name}>
|
<TableRowCell key={name}>
|
||||||
<MovieLanguage
|
<MovieLanguage
|
||||||
|
@@ -94,7 +94,7 @@ class HistoryRow extends Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name === 'movie.sortTitle') {
|
if (name === 'movies.sortTitle') {
|
||||||
return (
|
return (
|
||||||
<TableRowCell key={name}>
|
<TableRowCell key={name}>
|
||||||
<MovieTitleLink
|
<MovieTitleLink
|
||||||
|
@@ -133,7 +133,7 @@ class QueueRow extends Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name === 'movie.sortTitle') {
|
if (name === 'movies.sortTitle') {
|
||||||
return (
|
return (
|
||||||
<TableRowCell key={name}>
|
<TableRowCell key={name}>
|
||||||
{
|
{
|
||||||
|
@@ -27,7 +27,7 @@ export const defaultState = {
|
|||||||
|
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
name: 'movie.sortTitle',
|
name: 'movies.sortTitle',
|
||||||
label: 'Movie Title',
|
label: 'Movie Title',
|
||||||
isSortable: true,
|
isSortable: true,
|
||||||
isVisible: true
|
isVisible: true
|
||||||
@@ -39,7 +39,7 @@ export const defaultState = {
|
|||||||
isVisible: true
|
isVisible: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'language',
|
name: 'languages',
|
||||||
label: 'Language',
|
label: 'Language',
|
||||||
isSortable: true,
|
isSortable: true,
|
||||||
isVisible: true
|
isVisible: true
|
||||||
|
@@ -34,7 +34,7 @@ export const defaultState = {
|
|||||||
isModifiable: false
|
isModifiable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'movie.sortTitle',
|
name: 'movies.sortTitle',
|
||||||
label: 'Movie',
|
label: 'Movie',
|
||||||
isSortable: true,
|
isSortable: true,
|
||||||
isVisible: true
|
isVisible: true
|
||||||
|
@@ -63,7 +63,7 @@ export const defaultState = {
|
|||||||
isModifiable: false
|
isModifiable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'movie.sortTitle',
|
name: 'movies.sortTitle',
|
||||||
label: 'Movie',
|
label: 'Movie',
|
||||||
isSortable: true,
|
isSortable: true,
|
||||||
isVisible: 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.Common.Extensions;
|
|||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Datastore.Events;
|
using NzbDrone.Core.Datastore.Events;
|
||||||
using NzbDrone.Core.Download.Pending;
|
using NzbDrone.Core.Download.Pending;
|
||||||
|
using NzbDrone.Core.Languages;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
@@ -92,6 +93,12 @@ namespace Radarr.Api.V3.Queue
|
|||||||
? fullQueue.OrderBy(q => q.Quality, _qualityComparer)
|
? fullQueue.OrderBy(q => q.Quality, _qualityComparer)
|
||||||
: fullQueue.OrderByDescending(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
|
else
|
||||||
{
|
{
|
||||||
ordered = ascending ? fullQueue.OrderBy(orderByFunc) : fullQueue.OrderByDescending(orderByFunc);
|
ordered = ascending ? fullQueue.OrderBy(orderByFunc) : fullQueue.OrderByDescending(orderByFunc);
|
||||||
@@ -117,11 +124,11 @@ namespace Radarr.Api.V3.Queue
|
|||||||
{
|
{
|
||||||
case "status":
|
case "status":
|
||||||
return q => q.Status;
|
return q => q.Status;
|
||||||
case "movie.sortTitle":
|
case "movies.sortTitle":
|
||||||
return q => q.Movie.SortTitle;
|
return q => q.Movie.SortTitle;
|
||||||
case "title":
|
case "title":
|
||||||
return q => q.Title;
|
return q => q.Title;
|
||||||
case "language":
|
case "languages":
|
||||||
return q => q.Languages;
|
return q => q.Languages;
|
||||||
case "quality":
|
case "quality":
|
||||||
return q => q.Quality;
|
return q => q.Quality;
|
||||||
|
Reference in New Issue
Block a user