Skip to content

Commit 8d5b65f

Browse files
authored
Merge pull request #663 from bcgov/hotfix
chore: group listings
2 parents c88d1df + 8b3aadf commit 8d5b65f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

server/StrDss.Data/Repositories/RentalListingRepository.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ public async Task<PagedDto<RentalListingGroupDto>> GetGroupedRentalListings(stri
9494
ApplyFilters(all, address, url, listingId, hostName, businessLicence, prRequirement, blRequirement, lgId, statusArray, reassigned, takedownComplete, ref query);
9595

9696
var groupedQuery = query
97-
.AsNoTracking()
9897
.GroupBy(x => new { x.EffectiveBusinessLicenceNo, x.EffectiveHostNm, x.MatchAddressTxt })
9998
.Select(g => new RentalListingGroupDto
10099
{
101100
EffectiveBusinessLicenceNo = g.Key.EffectiveBusinessLicenceNo,
102101
EffectiveHostNm = g.Key.EffectiveHostNm,
103102
MatchAddressTxt = g.Key.MatchAddressTxt
104-
});
103+
})
104+
.AsNoTracking();
105105

106106
var extraSort = "";
107107

server/StrDss.Data/Repositories/RepositoryBase.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ public async Task<PagedDto<TOutput>> Page<TInput, TOutput>(IQueryable<TInput> li
4040

4141
var totalRecords = list.Count();
4242

43-
stopwatch.Stop();
44-
45-
_logger.LogDebug($"Get Grouped Listings (group) - Counting groups. Page Size: {pageSize}, Page Number: {pageNumber}, Time: {stopwatch.Elapsed.TotalSeconds} seconds");
46-
47-
stopwatch.Restart();
48-
4943
if (pageNumber <= 0) pageNumber = 1;
5044

5145
var sort = "";
@@ -72,6 +66,12 @@ public async Task<PagedDto<TOutput>> Page<TInput, TOutput>(IQueryable<TInput> li
7266
.Take(pageSize);
7367
}
7468

69+
stopwatch.Stop();
70+
71+
_logger.LogDebug($"Get Grouped Listings (group) - Counting groups. Page Size: {pageSize}, Page Number: {pageNumber}, Time: {stopwatch.Elapsed.TotalSeconds} seconds");
72+
73+
stopwatch.Restart();
74+
7575
var result = await pagedList.ToListAsync();
7676

7777
stopwatch.Stop();

0 commit comments

Comments
 (0)