diff --git a/src/.idea/.idea.NzbDrone/.idea/contentModel.xml b/src/.idea/.idea.NzbDrone/.idea/contentModel.xml index 52b29c10d..cbbd0c4e4 100644 --- a/src/.idea/.idea.NzbDrone/.idea/contentModel.xml +++ b/src/.idea/.idea.NzbDrone/.idea/contentModel.xml @@ -1,21 +1,24 @@ - + - - - + + + - - - - + + + + + + + - + @@ -67,10 +70,10 @@ - - - - + + + + @@ -1367,6 +1370,7 @@ + @@ -2558,6 +2562,7 @@ + @@ -3277,7 +3282,7 @@ - + @@ -3289,7 +3294,7 @@ - + diff --git a/src/NzbDrone.Core/Movies/MovieRepository.cs b/src/NzbDrone.Core/Movies/MovieRepository.cs index c22ff9bfc..90502e39d 100644 --- a/src/NzbDrone.Core/Movies/MovieRepository.cs +++ b/src/NzbDrone.Core/Movies/MovieRepository.cs @@ -140,7 +140,7 @@ public PagingSpec MoviesWithoutFiles(PagingSpec pagingSpec) return pagingSpec; }*/ - + /*protected override SortBuilder GetPagedQuery(QueryBuilder query, PagingSpec pagingSpec) { return DataMapper.Query().Join(JoinType.Left, m => m.AlternativeTitles, @@ -149,7 +149,7 @@ public PagingSpec MoviesWithoutFiles(PagingSpec pagingSpec) .Skip(pagingSpec.PagingOffset()) .Take(pagingSpec.PageSize); }*/ - + /*protected override SortBuilder GetPagedQuery(QueryBuilder query, PagingSpec pagingSpec) { var newQuery = base.GetPagedQuery(query.Join(JoinType.Left, m => m.JoinAlternativeTitles, (movie, title) => title.MovieId == movie.Id), pagingSpec); @@ -168,46 +168,15 @@ public SortBuilder GetMoviesWithoutFilesQuery(PagingSpec pagingSpe public PagingSpec MoviesWhereCutoffUnmet(PagingSpec pagingSpec, List 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($"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($"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 MoviesWhereCutoffUnmetQuery(PagingSpec pagingSpec, List qualitiesBelowCutoff) { - return Query.Join(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()) @@ -290,8 +259,8 @@ private Movie FindByTitle(string cleanTitle, int? year) return result; /*return year.HasValue ? results?.FirstOrDefault(movie => movie.Year == year.Value) - - + + : results?.FirstOrDefault();*/ } diff --git a/src/UI/Wanted/Cutoff/CutoffUnmetLayout.js b/src/UI/Wanted/Cutoff/CutoffUnmetLayout.js index 1d07b0328..5ffae4cca 100644 --- a/src/UI/Wanted/Cutoff/CutoffUnmetLayout.js +++ b/src/UI/Wanted/Cutoff/CutoffUnmetLayout.js @@ -43,8 +43,8 @@ module.exports = Marionette.Layout.extend({ cellValue : 'this', }, { - name : "downloadedQuality", - label : "Downloaded", + name : "movieFile.quality", + label : "Downloaded", cell : DownloadedQualityCell, sortable : true }, @@ -157,7 +157,7 @@ module.exports = Marionette.Layout.extend({ icon : 'icon-sonarr-movie-announced', callback : this._setFilter }, - { + { key : 'incinemas', title : '', tooltip : 'In Cinemas Only',