diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-08-01 12:46:37 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-01 12:46:37 -0400 |
| commit | cd8642a4bcba48b035e34ab46fd51eacb43b4d3b (patch) | |
| tree | 107db4f9281aedf50fa9e8abf2fcc0e4f2dea9f8 /Emby.Server.Implementations/Data/SqliteItemRepository.cs | |
| parent | ff42e5987f48fcfd29914c7666e65f4976b32927 (diff) | |
| parent | 30e673a4679a3c1f0e6a5f4027cccb266b6c2561 (diff) | |
Merge pull request #2790 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations/Data/SqliteItemRepository.cs')
| -rw-r--r-- | Emby.Server.Implementations/Data/SqliteItemRepository.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 3e2dbeefd..80a5defd6 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -2622,6 +2622,11 @@ namespace Emby.Server.Implementations.Data groups.Add("PresentationUniqueKey"); } + if (query.GroupBySeriesPresentationUniqueKey) + { + groups.Add("SeriesPresentationUniqueKey"); + } + if (groups.Count > 0) { return " Group by " + string.Join(",", groups.ToArray()); @@ -2934,6 +2939,10 @@ namespace Emby.Server.Implementations.Data { commandText += " select count (distinct PresentationUniqueKey)" + GetFromText(); } + else if (query.GroupBySeriesPresentationUniqueKey) + { + commandText += " select count (distinct SeriesPresentationUniqueKey)" + GetFromText(); + } else { commandText += " select count (guid)" + GetFromText(); @@ -3079,6 +3088,11 @@ namespace Emby.Server.Implementations.Data } if (string.Equals(name, ItemSortBy.DatePlayed, StringComparison.OrdinalIgnoreCase)) { + if (query.GroupBySeriesPresentationUniqueKey) + { + return new Tuple<string, bool>("MAX(LastPlayedDate)", false); + } + return new Tuple<string, bool>("LastPlayedDate", false); } if (string.Equals(name, ItemSortBy.PlayCount, StringComparison.OrdinalIgnoreCase)) @@ -3353,6 +3367,10 @@ namespace Emby.Server.Implementations.Data { commandText += " select count (distinct PresentationUniqueKey)" + GetFromText(); } + else if (query.GroupBySeriesPresentationUniqueKey) + { + commandText += " select count (distinct SeriesPresentationUniqueKey)" + GetFromText(); + } else { commandText += " select count (guid)" + GetFromText(); @@ -4640,6 +4658,11 @@ namespace Emby.Server.Implementations.Data return false; } + if (query.GroupBySeriesPresentationUniqueKey) + { + return false; + } + if (!string.IsNullOrWhiteSpace(query.PresentationUniqueKey)) { return false; |
