Skip to content

Commit 3d22e16

Browse files
authored
Merge pull request #581 from bcgov/yj
chore: performance
2 parents 0b6e400 + 644ac08 commit 3d22e16

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server/StrDss.Data/Repositories/RentalListingRepository.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ private async Task<List<RentalListingViewDto>> GetRentalListings(string? effecti
218218

219219
ApplyFilters(all, address, url, listingId, hostName, businessLicence, prRequirement, blRequirement, lgId, statusArray, reassigned, takedownComplete, ref query);
220220

221-
var filteredIds = await query.Select(x => x.RentalListingId).ToListAsync();
221+
var filteredIds = await query.Select(x => x.RentalListingId ?? 0).ToListAsync();
222+
223+
var filteredIdSet = new HashSet<long>(filteredIds);
222224

223225
stopwatch.Stop();
224226

@@ -242,7 +244,7 @@ await _dbSet.AsNoTracking()
242244
{
243245
await SetExtraProperties(listing);
244246

245-
listing.Filtered = filteredIds.Contains(listing.RentalListingId);
247+
listing.Filtered = filteredIdSet.Contains(listing.RentalListingId ?? 0);
246248

247249
group.NightsBookedYtdQty += listing.NightsBookedYtdQty ?? 0;
248250
}

0 commit comments

Comments
 (0)