Skip to content

Commit

Permalink
Merge pull request #581 from bcgov/yj
Browse files Browse the repository at this point in the history
chore: performance
  • Loading branch information
ychung-mot committed Aug 29, 2024
2 parents 0b6e400 + 644ac08 commit 3d22e16
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/StrDss.Data/Repositories/RentalListingRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ private async Task<List<RentalListingViewDto>> GetRentalListings(string? effecti

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

var filteredIds = await query.Select(x => x.RentalListingId).ToListAsync();
var filteredIds = await query.Select(x => x.RentalListingId ?? 0).ToListAsync();

var filteredIdSet = new HashSet<long>(filteredIds);

stopwatch.Stop();

Expand All @@ -242,7 +244,7 @@ await _dbSet.AsNoTracking()
{
await SetExtraProperties(listing);

listing.Filtered = filteredIds.Contains(listing.RentalListingId);
listing.Filtered = filteredIdSet.Contains(listing.RentalListingId ?? 0);

group.NightsBookedYtdQty += listing.NightsBookedYtdQty ?? 0;
}
Expand Down

0 comments on commit 3d22e16

Please sign in to comment.