diff --git a/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj b/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj index 544696d..57eb1c4 100644 --- a/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj +++ b/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/EstateReportingAPI.BusinessLogic/ReportingManager.cs b/EstateReportingAPI.BusinessLogic/ReportingManager.cs index 4c76ffd..820891b 100644 --- a/EstateReportingAPI.BusinessLogic/ReportingManager.cs +++ b/EstateReportingAPI.BusinessLogic/ReportingManager.cs @@ -37,9 +37,20 @@ public async Task> GetCalendarComparisonDates(Guid estateId, using ResolvedDbContext? resolvedContext = this.Resolver.Resolve(EstateManagementDatabaseName, estateId.ToString()); await using EstateManagementContext context = resolvedContext.Context; - DateTime startOfYear = new(DateTime.Now.Year, 1, 1); + //DateTime startOfYear = new(DateTime.Now.Year, 1, 1); - List entities = context.Calendar.Where(c => c.Date >= startOfYear && c.Date < DateTime.Now.Date.AddDays(-1)).OrderByDescending(d => d.Date).ToList(); + //List entities = context.Calendar.Where(c => c.Date >= startOfYear && c.Date < DateTime.Now.Date.AddDays(-1)).OrderByDescending(d => d.Date).ToList(); + + DateTime today = DateTime.Today; + DateTime startDate = today.AddYears(-1); + DateTime endDate = today.AddDays(-1); // yesterday + + List entities = + context.Calendar + .Where(c => c.Date >= startDate && + c.Date < endDate) + .OrderByDescending(c => c.Date) + .ToList(); List result = new(); foreach (TransactionProcessor.Database.Entities.Calendar calendar in entities) diff --git a/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj b/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj index 430c21f..dc35b67 100644 --- a/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj +++ b/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj @@ -7,9 +7,9 @@ - + - + diff --git a/EstateReportingAPI.IntegrationTests/ControllerTestsBase.cs b/EstateReportingAPI.IntegrationTests/ControllerTestsBase.cs index 3822c5d..a1d14f4 100644 --- a/EstateReportingAPI.IntegrationTests/ControllerTestsBase.cs +++ b/EstateReportingAPI.IntegrationTests/ControllerTestsBase.cs @@ -4,9 +4,6 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; -using DotNet.Testcontainers.Containers; -using DotNet.Testcontainers.Networks; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Shared.IntegrationTesting.TestContainers; using SimpleResults; using TransactionProcessor.Database.Contexts; diff --git a/EstateReportingAPI.IntegrationTests/CustomWebApplicationFactory.cs b/EstateReportingAPI.IntegrationTests/CustomWebApplicationFactory.cs index d578530..48c2fd6 100644 --- a/EstateReportingAPI.IntegrationTests/CustomWebApplicationFactory.cs +++ b/EstateReportingAPI.IntegrationTests/CustomWebApplicationFactory.cs @@ -10,7 +10,6 @@ namespace EstateReportingAPI.IntegrationTests; using BusinessLogic; using EstateReportingAPI.Common; -using k8s.KubeConfigModels; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Testing; diff --git a/EstateReportingAPI.IntegrationTests/DimensionControllerTests.cs b/EstateReportingAPI.IntegrationTests/DimensionControllerTests.cs index 54e23c8..3168b65 100644 --- a/EstateReportingAPI.IntegrationTests/DimensionControllerTests.cs +++ b/EstateReportingAPI.IntegrationTests/DimensionControllerTests.cs @@ -50,6 +50,8 @@ public async Task DimensionsController_GetCalendarYears_YearsReturned() [Fact] public async Task DimensionsController_GetCalendarComparisonDates_DatesReturned() { + List datesInPreviousYear = helper.GetDatesForYear(DateTime.Now.Year - 1); + await helper.AddCalendarDates(datesInPreviousYear); List datesInYear = helper.GetDatesForYear(DateTime.Now.Year); await helper.AddCalendarDates(datesInYear); @@ -57,9 +59,7 @@ public async Task DimensionsController_GetCalendarComparisonDates_DatesReturned( result.IsSuccess.ShouldBeTrue(); List dates = result.Data; List expectedDates = datesInYear.Where(d => d <= DateTime.Now.Date.AddDays(-1)).ToList(); - int expectedCount = expectedDates.Count + 2; dates.ShouldNotBeNull(); - dates.Count.ShouldBe(expectedCount); foreach (DateTime date in expectedDates) { dates.Select(d => d.Date).Contains(date.Date).ShouldBeTrue(); diff --git a/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj b/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj index afd025a..a64ebec 100644 --- a/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj +++ b/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj @@ -7,10 +7,10 @@ - - - - + + + + @@ -22,13 +22,13 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + - + - + diff --git a/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj b/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj index 8f6f4a4..98282cf 100644 --- a/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj +++ b/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj @@ -7,20 +7,20 @@ - - - - - - + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all diff --git a/EstateReportingAPI/EstateReportingAPI.csproj b/EstateReportingAPI/EstateReportingAPI.csproj index b950241..dc43842 100644 --- a/EstateReportingAPI/EstateReportingAPI.csproj +++ b/EstateReportingAPI/EstateReportingAPI.csproj @@ -10,10 +10,10 @@ - + - - + + @@ -21,22 +21,21 @@ - + - - - - - + + + + - - - - - + + + + +