mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-17 22:43:07 +03:00
improve nextup queries
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user