From 2bb8205da05e23da7c79b36101b2e853e189c1ad Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Fri, 29 Sep 2023 15:25:29 +0200 Subject: [PATCH] DeliveryJournal: Fix ordering --- Elwig/Documents/DeliveryJournal.cshtml.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Elwig/Documents/DeliveryJournal.cshtml.cs b/Elwig/Documents/DeliveryJournal.cshtml.cs index 9a513c4..2e4e24f 100644 --- a/Elwig/Documents/DeliveryJournal.cshtml.cs +++ b/Elwig/Documents/DeliveryJournal.cshtml.cs @@ -1,5 +1,6 @@ using Elwig.Helpers; using Elwig.Models; +using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; @@ -15,11 +16,18 @@ namespace Elwig.Documents { Deliveries = deliveries; } + public DeliveryJournal(string filter, IQueryable deliveries) : + this(filter, (IEnumerable)deliveries + .Include(p => p.Delivery) + .Include(p => p.Delivery.Member) + .Include(p => p.Variant)) { } + public DeliveryJournal(AppDbContext ctx, DateOnly date) : this(date.ToString("dd.MM.yyyy"), ctx.DeliveryParts .Where(p => p.Delivery.DateString == date.ToString("yyy-MM-dd")) - .OrderBy(p => p.Delivery.LsNr) - .ThenBy(p => p.DPNr) - .ToList()) { } + .OrderBy(p => p.Delivery.DateString) + .ThenBy(p => p.Delivery.TimeString) + .ThenBy(p => p.Delivery.LsNr) + .ThenBy(p => p.DPNr)) { } } }