From ae61c81575085a560d7132b255f6bf965e15c85d Mon Sep 17 00:00:00 2001 From: Sergio Navarro Date: Thu, 25 Jun 2015 20:26:15 +0200 Subject: [PATCH] #5426 Projections don't order queries following Position field Projections don't order queries following the Position field of each order in the query Related issue https://github.com/OrchardCMS/Orchard/issues/5426 --- .../Orchard.Projections/Services/ProjectionManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Projections/Services/ProjectionManager.cs b/src/Orchard.Web/Modules/Orchard.Projections/Services/ProjectionManager.cs index 687e0d246..b6aa4ed87 100644 --- a/src/Orchard.Web/Modules/Orchard.Projections/Services/ProjectionManager.cs +++ b/src/Orchard.Web/Modules/Orchard.Projections/Services/ProjectionManager.cs @@ -147,7 +147,7 @@ namespace Orchard.Projections.Services { var groupQuery = _contentManager.HqlQuery().Where(alias => alias.Named("ci"), x => x.InG("Id", ids)); // iterate over each sort criteria to apply the alterations to the query object - foreach (var sortCriterion in queryRecord.SortCriteria) { + foreach (var sortCriterion in queryRecord.SortCriteria.OrderBy(s => s.Position)) { var sortCriterionContext = new SortCriterionContext { Query = groupQuery, State = FormParametersHelper.ToDynamic(sortCriterion.State) @@ -210,7 +210,7 @@ namespace Orchard.Projections.Services { } // iterate over each sort criteria to apply the alterations to the query object - foreach (var sortCriterion in sortCriteria) { + foreach (var sortCriterion in sortCriteria.OrderBy(s => s.Position)) { var sortCriterionContext = new SortCriterionContext { Query = contentQuery, State = FormParametersHelper.ToDynamic(sortCriterion.State) @@ -240,4 +240,4 @@ namespace Orchard.Projections.Services { } } } -} \ No newline at end of file +}