From 78aa91f9e42d1bf39ba4fc2d296b24ed370c23a4 Mon Sep 17 00:00:00 2001 From: Jay Malhotra Date: Thu, 31 Oct 2024 22:06:00 +0000 Subject: [PATCH] Use projection --- .../DragaliaAPI/Features/Fort/FortService.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/DragaliaAPI/DragaliaAPI/Features/Fort/FortService.cs b/DragaliaAPI/DragaliaAPI/Features/Fort/FortService.cs index 268502219..fcc7a2fec 100644 --- a/DragaliaAPI/DragaliaAPI/Features/Fort/FortService.cs +++ b/DragaliaAPI/DragaliaAPI/Features/Fort/FortService.cs @@ -357,7 +357,14 @@ public async Task EndLevelup(long buildId) { logger.LogDebug( "Building {@Build} has not finished levelling up. Current time: {Time}", - build, + new + { + build.BuildId, + build.PlantId, + build.Level, + build.BuildStartDate, + build.BuildEndDate, + }, time ); throw new InvalidOperationException($"This building has not completed levelling up."); @@ -509,8 +516,16 @@ private async Task Upgrade(FortPlantDetail plantDetail) // Check Carpenter available if (fortDetail.WorkingCarpenterNum >= fortDetail.CarpenterNum) { - List builds = await fortRepository + var builds = await fortRepository .Builds.Where(x => x.BuildEndDate != DateTimeOffset.UnixEpoch) + .Select(x => new + { + x.BuildId, + x.PlantId, + x.Level, + x.BuildStartDate, + x.BuildEndDate, + }) .ToListAsync(); logger.LogDebug(