Skip to content

Commit 39602d0

Browse files
committed
Empty List Fix
Added a check to the report list to make sure it isn't empty before we process it.
1 parent f7639bc commit 39602d0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

server/StrDss.Data/Repositories/RentalListingReportRepository.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ public async Task UpdateInactiveListings(long providingPlatformId)
128128
.Where(x => x.ProvidingOrganizationId == providingPlatformId && x.DssRentalListings.Any())
129129
.ToListAsync();
130130

131+
if (reports.Count == 0)
132+
{
133+
stopwatch.Stop();
134+
_logger.LogDebug($"UpdateInactiveListings - skipping due to no report with associated listing.");
135+
return;
136+
}
131137
var latestPeriodYm = reports.Max(x => x.ReportPeriodYm);
132138
var lastestReport = reports.First(x => x.ReportPeriodYm == latestPeriodYm);
133139

0 commit comments

Comments
 (0)