From f7dfe6f56ab7e008f112b065251856ba91ad65c2 Mon Sep 17 00:00:00 2001 From: ychung-mot Date: Thu, 21 Nov 2024 14:31:43 -0800 Subject: [PATCH] chore: enhance count query --- .../StrDss.Data/Repositories/RentalListingRepository.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/server/StrDss.Data/Repositories/RentalListingRepository.cs b/server/StrDss.Data/Repositories/RentalListingRepository.cs index fba887e1..18ea6814 100644 --- a/server/StrDss.Data/Repositories/RentalListingRepository.cs +++ b/server/StrDss.Data/Repositories/RentalListingRepository.cs @@ -146,13 +146,8 @@ public async Task GetGroupedRentalListingsCount(string? all, string? addres ApplyFilters(all, address, url, listingId, hostName, businessLicence, prRequirement, blRequirement, lgId, statusArray, reassigned, takedownComplete, ref query); var count = await query - .GroupBy(x => new { x.EffectiveBusinessLicenceNo, x.EffectiveHostNm, x.MatchAddressTxt }) - .Select(g => new RentalListingGroupDto - { - EffectiveBusinessLicenceNo = g.Key.EffectiveBusinessLicenceNo, - EffectiveHostNm = g.Key.EffectiveHostNm, - MatchAddressTxt = g.Key.MatchAddressTxt - }) + .Select(x => new { x.EffectiveBusinessLicenceNo, x.EffectiveHostNm, x.MatchAddressTxt }) + .Distinct() .CountAsync(); stopwatch.Stop();