From 8d4cd908dcacbbf08dcd786d5ee61914f6bb0b83 Mon Sep 17 00:00:00 2001 From: Gianluigi Liguori Date: Wed, 29 Nov 2023 18:36:07 +0100 Subject: [PATCH] Include last item before today --- src/Savings.SPA/Pages/Projection.razor.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Savings.SPA/Pages/Projection.razor.cs b/src/Savings.SPA/Pages/Projection.razor.cs index c00e1ed..2b416c5 100644 --- a/src/Savings.SPA/Pages/Projection.razor.cs +++ b/src/Savings.SPA/Pages/Projection.razor.cs @@ -52,7 +52,11 @@ async Task InitializeList() if (HidePastItems) { - materializedMoneyItems= materializedMoneyItems.Where(x=>x.Date>=DateTime.Now.Date).ToArray(); + var lastBeforeToday = materializedMoneyItems.LastOrDefault(x => x.Date <= DateTime.Now.Date); + if (lastBeforeToday != null) + { + materializedMoneyItems = materializedMoneyItems[Array.IndexOf(materializedMoneyItems, lastBeforeToday)..]; + } } }