From 2ce92e2daca8025a7b2d5ff99289a5c7fb46aa20 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 17 Jun 2016 15:32:48 -0400 Subject: [PATCH 1/2] consolidate artists scripts --- MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 3456ea2cc..a8fedd678 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -965,9 +965,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest From ff61f2128bb5fd52d868bf9b901722db2190404b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 17 Jun 2016 20:52:04 -0400 Subject: [PATCH 2/2] fix artist total record count --- .../Persistence/SqliteItemRepository.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 121074a6e..878fcbe0c 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -3618,7 +3618,6 @@ namespace MediaBrowser.Server.Implementations.Persistence var whereText = " where Type=@SelectType"; whereText += " And CleanName In (Select CleanValue from ItemValues where Type=@ItemValueType AND ItemId in (select guid from TypedBaseItems" + innerWhereText + "))"; - cmd.CommandText += whereText; var outerQuery = new InternalItemsQuery(query.User) { @@ -3638,10 +3637,13 @@ namespace MediaBrowser.Server.Implementations.Persistence var outerWhereClauses = GetWhereClauses(outerQuery, cmd); - var outerWhereText = outerWhereClauses.Count == 0 ? + whereText += outerWhereClauses.Count == 0 ? string.Empty : " AND " + string.Join(" AND ", outerWhereClauses.ToArray()); - cmd.CommandText += outerWhereText; + //cmd.CommandText += GetGroupBy(query); + + cmd.CommandText += whereText; + cmd.CommandText += " group by PresentationUniqueKey"; cmd.Parameters.Add(cmd, "@SelectType", DbType.String).Value = returnType; cmd.Parameters.Add(cmd, "@ItemValueType", DbType.Int32).Value = itemValueType; @@ -3651,9 +3653,6 @@ namespace MediaBrowser.Server.Implementations.Persistence cmd.Parameters.Add(cmd, "@UserId", DbType.Guid).Value = query.User.Id; } - //cmd.CommandText += GetGroupBy(query); - cmd.CommandText += " group by PresentationUniqueKey"; - cmd.CommandText += " order by SortName"; if (query.Limit.HasValue || query.StartIndex.HasValue) @@ -3679,7 +3678,7 @@ namespace MediaBrowser.Server.Implementations.Persistence if (query.EnableTotalRecordCount) { - cmd.CommandText += "select count (guid)" + GetFromText(); + cmd.CommandText += "select count (distinct PresentationUniqueKey)" + GetFromText(); cmd.CommandText += GetJoinUserDataText(query); cmd.CommandText += whereText;