Skip to content

Commit 97f0a2a

Browse files
authored
Merge pull request #911 from bcgov/bug/DSS-1150
DSS-1150 Internal Server Error - Sorting
2 parents b74ff66 + 01a7acc commit 97f0a2a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

server/StrDss.Data/Repositories/RentalListingRepository.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,23 @@ var extraSort
6464

6565
if (orderBy == "lastActionDtm")
6666
{
67-
orderBy = "lastActionDtm == null, lastActionDtm";
67+
orderBy = "lastActionDtm ?? System.DateTime.MinValue";
6868
}
6969
else if (orderBy == "lastActionNm")
7070
{
71-
orderBy = "lastActionNm == null, lastActionNm";
71+
orderBy = "lastActionNm ?? \"ZZZZ\"";
7272
}
7373
else if (orderBy == "businessLicenceNo")
7474
{
75-
orderBy = "string.IsNullOrWhiteSpace(businessLicenceNo), businessLicenceNo";
75+
orderBy = "businessLicenceNo ?? \"ZZZZ\"";
7676
}
7777
else if (orderBy == "businessLicenceNoMatched")
7878
{
79-
orderBy = "string.IsNullOrWhiteSpace(businessLicenceNoMatched), businessLicenceNoMatched";
79+
orderBy = "businessLicenceNoMatched ?? \"ZZZZ\"";
8080
}
8181
else if (orderBy == "nightsBookedYtdQty")
8282
{
83-
orderBy = "nightsBookedYtdQty";
83+
orderBy = "nightsBookedYtdQty ?? -1";
8484
}
8585

8686
var listings = await Page<DssRentalListingVw, RentalListingViewDto>(query, pageSize, pageNumber, orderBy, direction, extraSort);
@@ -114,7 +114,7 @@ public async Task<PagedDto<RentalListingGroupDto>> GetGroupedRentalListings(stri
114114

115115
if (orderBy == "effectiveBusinessLicenceNo")
116116
{
117-
orderBy = "string.IsNullOrWhiteSpace(effectiveBusinessLicenceNo), effectiveBusinessLicenceNo";
117+
orderBy = "effectiveBusinessLicenceNo ?? \"ZZZZ\"";
118118
}
119119

120120
var groupedQuery = query

0 commit comments

Comments
 (0)