From 3e240b22cb238607ee09e9f27ac116e5e1d1ee9c Mon Sep 17 00:00:00 2001 From: yiyiwang-cgi <116315451+yiyiwang-cgi@users.noreply.github.com> Date: Wed, 25 Sep 2024 11:41:20 -0700 Subject: [PATCH] Fix the start date and end date on query monthly report template (#245) --- .../FundingReports/P615CreateMonthlyReportProvider.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OFM.Infrastructure.WebAPI/Services/Processes/FundingReports/P615CreateMonthlyReportProvider.cs b/OFM.Infrastructure.WebAPI/Services/Processes/FundingReports/P615CreateMonthlyReportProvider.cs index 62f17a6..2854dc7 100644 --- a/OFM.Infrastructure.WebAPI/Services/Processes/FundingReports/P615CreateMonthlyReportProvider.cs +++ b/OFM.Infrastructure.WebAPI/Services/Processes/FundingReports/P615CreateMonthlyReportProvider.cs @@ -198,7 +198,7 @@ public async Task RunProcessAsync(ID365AppUserService appUserService var monthEndDateInUTC = monthEndDateInPST.ToUTC(); //Set the fiscal year and duedate - //fetch the current fiscal year + //fetch the current fiscal year -> fiscal year startDate and endDate are not DateOnly var fiscalYearFetchXML = $""" @@ -223,12 +223,12 @@ public async Task RunProcessAsync(ID365AppUserService appUserService var fiscalYear = fiscalYearData.Data.AsArray().FirstOrDefault()?["ofm_fiscal_yearid"]; - //fetch the template + //fetch the template -> template startDate and endDate are DateOnly -> PST Date var reportTemplateFetchXML = $""" - + @@ -240,7 +240,7 @@ public async Task RunProcessAsync(ID365AppUserService appUserService """.CleanCRLF(); var reportTemplateData = await GetReportDataAsync(requestReportTemplateUri); var serializedReportTemplateDate = System.Text.Json.JsonSerializer.Deserialize>(reportTemplateData.Data, Setup.s_writeOptionsForLogs); - var reportTemplate = serializedReportTemplateDate.Where(t => t.ofm_end_date == null || t.ofm_end_date >= monthEndDateInUTC).FirstOrDefault(); + var reportTemplate = serializedReportTemplateDate.Where(t => t.ofm_end_date == null || t.ofm_end_date?.Date >= monthEndDateInPST.Date).FirstOrDefault(); if(reportTemplate == null) { _logger.LogInformation(CustomLogEvent.Process, "Cannot find report template.");