mirror of https://github.com/Radarr/Radarr
Fixed: Cutoff Unmet Sorting by Downloaded Quality not working.
Fixes #2678
This commit is contained in:
parent
802768bd24
commit
00877ad361
|
@ -1,21 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ContentModelStore">
|
||||
<e p="$PROJECT_DIR$/../_output" t="ExcludeRecursive">
|
||||
<e p="E:\C++ Projects\Sonarr\_output" t="ExcludeRecursive">
|
||||
<e p="NzbDrone.Update" t="ExcludeRecursive" />
|
||||
</e>
|
||||
<e p="$PROJECT_DIR$/../Logo/1024.png" t="Include" />
|
||||
<e p="$PROJECT_DIR$/../Logo/64.png" t="Include" />
|
||||
<e p="$PROJECT_DIR$" t="IncludeFlat">
|
||||
<e p="E:\C++ Projects\Sonarr\Logo\1024.png" t="Include" />
|
||||
<e p="E:\C++ Projects\Sonarr\Logo\64.png" t="Include" />
|
||||
<e p="E:\C++ Projects\Sonarr\src" t="IncludeFlat">
|
||||
<e p=".nuget" t="Include">
|
||||
<e p="NuGet.exe" t="Include" />
|
||||
</e>
|
||||
<e p="_ReSharper.Caches/ReSharperHost12.NzbDrone.00" t="ExcludeRecursive" />
|
||||
<e p="Common/CommonAssemblyInfo.cs" t="Include" />
|
||||
<e p="Common/CommonVersionInfo.cs" t="Include" />
|
||||
<e p="Common/GlobalSuppressions.cs" t="Include" />
|
||||
<e p="_ReSharper.Caches\ReSharperHost11.NzbDrone.00" t="ExcludeRecursive" />
|
||||
<e p="Common" t="Include">
|
||||
<e p="CodeAnalysisDictionary.xml" t="Include" />
|
||||
<e p="CommonAssemblyInfo.cs" t="Include" />
|
||||
<e p="CommonVersionInfo.cs" t="Include" />
|
||||
<e p="GlobalSuppressions.cs" t="Include" />
|
||||
</e>
|
||||
<e p="External" t="Include" />
|
||||
<e p="ExternalModules/CurlSharp/CurlSharp" t="IncludeRecursive">
|
||||
<e p="ExternalModules\CurlSharp\CurlSharp" t="IncludeRecursive">
|
||||
<e p="bin" t="ExcludeRecursive" />
|
||||
<e p="Callbacks" t="Include">
|
||||
<e p="CurlEasyCallbacks.cs" t="Include" />
|
||||
|
@ -67,10 +70,10 @@
|
|||
</e>
|
||||
</e>
|
||||
<e p="Host" t="Include" />
|
||||
<e p="Libraries/MediaInfo/libmediainfo.0.dylib" t="Include" />
|
||||
<e p="Libraries/MediaInfo/MediaInfo.dll" t="Include" />
|
||||
<e p="Libraries/Sqlite/libsqlite3.0.dylib" t="Include" />
|
||||
<e p="Libraries/Sqlite/sqlite3.dll" t="Include" />
|
||||
<e p="Libraries\MediaInfo\libmediainfo.0.dylib" t="Include" />
|
||||
<e p="Libraries\MediaInfo\MediaInfo.dll" t="Include" />
|
||||
<e p="Libraries\Sqlite\libsqlite3.0.dylib" t="Include" />
|
||||
<e p="Libraries\Sqlite\sqlite3.dll" t="Include" />
|
||||
<e p="LogentriesCore" t="IncludeRecursive">
|
||||
<e p="AsyncLogger.cs" t="Include" />
|
||||
<e p="bin" t="ExcludeRecursive" />
|
||||
|
@ -1367,6 +1370,7 @@
|
|||
<e p="BlacklistSpecification.cs" t="Include" />
|
||||
<e p="CutoffSpecification.cs" t="Include" />
|
||||
<e p="LanguageSpecification.cs" t="Include" />
|
||||
<e p="MaximumSizeSpecification.cs" t="Include" />
|
||||
<e p="MinimumAgeSpecification.cs" t="Include" />
|
||||
<e p="NotSampleSpecification.cs" t="Include" />
|
||||
<e p="ProtocolSpecification.cs" t="Include" />
|
||||
|
@ -2558,6 +2562,7 @@
|
|||
<e p="DownloadDecisionMakerFixture.cs" t="Include" />
|
||||
<e p="HistorySpecificationFixture.cs" t="Include" />
|
||||
<e p="LanguageSpecificationFixture.cs" t="Include" />
|
||||
<e p="MaximumSizeSpecificationFixture.cs" t="Include" />
|
||||
<e p="MinimumAgeSpecificationFixture.cs" t="Include" />
|
||||
<e p="MonitoredMovieSpecificationFixture.cs" t="Include" />
|
||||
<e p="PrioritizeDownloadDecisionFixture.cs" t="Include" />
|
||||
|
@ -3277,7 +3282,7 @@
|
|||
</e>
|
||||
<e p="packages" t="ExcludeRecursive" />
|
||||
<e p="Platform" t="Include" />
|
||||
<e p="ServiceHelpers/ServiceInstall" t="IncludeRecursive">
|
||||
<e p="ServiceHelpers\ServiceInstall" t="IncludeRecursive">
|
||||
<e p="app.config" t="Include" />
|
||||
<e p="app.manifest" t="Include" />
|
||||
<e p="green_puzzle.ico" t="Include" />
|
||||
|
@ -3289,7 +3294,7 @@
|
|||
<e p="ServiceHelper.cs" t="Include" />
|
||||
<e p="ServiceInstall.csproj" t="IncludeRecursive" />
|
||||
</e>
|
||||
<e p="ServiceHelpers/ServiceUninstall" t="IncludeRecursive">
|
||||
<e p="ServiceHelpers\ServiceUninstall" t="IncludeRecursive">
|
||||
<e p="app.config" t="Include" />
|
||||
<e p="app.manifest" t="Include" />
|
||||
<e p="obj" t="ExcludeRecursive" />
|
||||
|
|
|
@ -168,46 +168,15 @@ namespace NzbDrone.Core.Movies
|
|||
|
||||
public PagingSpec<Movie> MoviesWhereCutoffUnmet(PagingSpec<Movie> pagingSpec, List<QualitiesBelowCutoff> qualitiesBelowCutoff)
|
||||
{
|
||||
//I know this is bad, but if you have a better Idea please tell me.
|
||||
if (pagingSpec.SortKey == "downloadedQuality")
|
||||
{
|
||||
var mapper = _database.GetDataMapper();
|
||||
var offset = pagingSpec.PagingOffset();
|
||||
var limit = pagingSpec.PageSize;
|
||||
var direction = "ASC";
|
||||
if (pagingSpec.SortDirection == NzbDrone.Core.Datastore.SortDirection.Descending)
|
||||
{
|
||||
direction = "DESC";
|
||||
}
|
||||
|
||||
var whereClause = BuildQualityCutoffWhereClauseSpecial(qualitiesBelowCutoff);
|
||||
|
||||
var q = mapper.Query<Movie>($"SELECT * from \"Movies\" , \"MovieFiles\", \"QualityDefinitions\" WHERE Movies.MovieFileId=MovieFiles.Id AND instr(MovieFiles.Quality, ('quality\": ' || QualityDefinitions.Quality || \",\")) > 0 AND {whereClause} ORDER BY QualityDefinitions.Title {direction} LIMIT {offset},{limit};");
|
||||
var q2 = mapper.Query<Movie>($"SELECT * from \"Movies\" , \"MovieFiles\", \"QualityDefinitions\" WHERE Movies.MovieFileId=MovieFiles.Id AND instr(MovieFiles.Quality, ('quality\": ' || QualityDefinitions.Quality || \",\")) > 0 AND {whereClause} ORDER BY QualityDefinitions.Title ASC;");
|
||||
|
||||
var q3 = Query.OrderBy(m => m.MovieFile.Quality.Quality);
|
||||
var ok = q3.BuildQuery();
|
||||
var t = ok;
|
||||
|
||||
pagingSpec.Records = q.ToList();
|
||||
pagingSpec.TotalRecords = q2.Count();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
pagingSpec.TotalRecords = MoviesWhereCutoffUnmetQuery(pagingSpec, qualitiesBelowCutoff).GetRowCount();
|
||||
pagingSpec.Records = MoviesWhereCutoffUnmetQuery(pagingSpec, qualitiesBelowCutoff).ToList();
|
||||
|
||||
}
|
||||
pagingSpec.TotalRecords = MoviesWhereCutoffUnmetQuery(pagingSpec, qualitiesBelowCutoff).GetRowCount();
|
||||
pagingSpec.Records = MoviesWhereCutoffUnmetQuery(pagingSpec, qualitiesBelowCutoff).ToList();
|
||||
|
||||
return pagingSpec;
|
||||
}
|
||||
|
||||
private SortBuilder<Movie> MoviesWhereCutoffUnmetQuery(PagingSpec<Movie> pagingSpec, List<QualitiesBelowCutoff> qualitiesBelowCutoff)
|
||||
{
|
||||
return Query.Join<Movie, MovieFile>(JoinType.Left, e => e.MovieFile, (e, s) => e.MovieFileId == s.Id)
|
||||
.Where(pagingSpec.FilterExpression)
|
||||
return Query.Where(pagingSpec.FilterExpression)
|
||||
.AndWhere(m => m.MovieFileId != 0)
|
||||
.AndWhere(BuildQualityCutoffWhereClause(qualitiesBelowCutoff))
|
||||
.OrderBy(pagingSpec.OrderByClause(), pagingSpec.ToSortDirection())
|
||||
|
|
|
@ -43,7 +43,7 @@ module.exports = Marionette.Layout.extend({
|
|||
cellValue : 'this',
|
||||
},
|
||||
{
|
||||
name : "downloadedQuality",
|
||||
name : "movieFile.quality",
|
||||
label : "Downloaded",
|
||||
cell : DownloadedQualityCell,
|
||||
sortable : true
|
||||
|
|
Loading…
Reference in New Issue