Skip to content

Commit

Permalink
Merge pull request #663 from bcgov/hotfix
Browse files Browse the repository at this point in the history
chore: group listings
  • Loading branch information
ychung-mot committed Sep 20, 2024
2 parents c88d1df + 8b3aadf commit 8d5b65f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions server/StrDss.Data/Repositories/RentalListingRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ public async Task<PagedDto<RentalListingGroupDto>> GetGroupedRentalListings(stri
ApplyFilters(all, address, url, listingId, hostName, businessLicence, prRequirement, blRequirement, lgId, statusArray, reassigned, takedownComplete, ref query);

var groupedQuery = query
.AsNoTracking()
.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
});
})
.AsNoTracking();

var extraSort = "";

Expand Down
12 changes: 6 additions & 6 deletions server/StrDss.Data/Repositories/RepositoryBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ public async Task<PagedDto<TOutput>> Page<TInput, TOutput>(IQueryable<TInput> li

var totalRecords = list.Count();

stopwatch.Stop();

_logger.LogDebug($"Get Grouped Listings (group) - Counting groups. Page Size: {pageSize}, Page Number: {pageNumber}, Time: {stopwatch.Elapsed.TotalSeconds} seconds");

stopwatch.Restart();

if (pageNumber <= 0) pageNumber = 1;

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

stopwatch.Stop();

_logger.LogDebug($"Get Grouped Listings (group) - Counting groups. Page Size: {pageSize}, Page Number: {pageNumber}, Time: {stopwatch.Elapsed.TotalSeconds} seconds");

stopwatch.Restart();

var result = await pagedList.ToListAsync();

stopwatch.Stop();
Expand Down

0 comments on commit 8d5b65f

Please sign in to comment.