Skip to content

Commit

Permalink
fix: sort table with listings approval statuses (bloom-housing#3622)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyjablonski authored and ludtkemorgan committed Sep 5, 2023
1 parent 5b69193 commit 00eca07
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/core/src/listings/db/listing-query-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export class ListingsQueryBuilder extends SelectQueryBuilder<Listing> {
if (orderByCondition.orderBy === "listings.status") {
const orderStr =
orderByCondition.orderDir === "ASC"
? `CASE WHEN ${orderByCondition.orderBy} = '${ListingStatus.pending}' THEN 1 WHEN ${orderByCondition.orderBy} = '${ListingStatus.active}' THEN 2 WHEN ${orderByCondition.orderBy} = '${ListingStatus.closed}' THEN 3 END`
: `CASE WHEN ${orderByCondition.orderBy} = '${ListingStatus.closed}' THEN 1 WHEN ${orderByCondition.orderBy} = '${ListingStatus.active}' THEN 2 WHEN ${orderByCondition.orderBy} = '${ListingStatus.pending}' THEN 3 END`
? `CASE WHEN ${orderByCondition.orderBy} = '${ListingStatus.pendingReview}' THEN 1 WHEN ${orderByCondition.orderBy} = '${ListingStatus.changesRequested}' THEN 2 WHEN ${orderByCondition.orderBy} = '${ListingStatus.pending}' THEN 3 WHEN ${orderByCondition.orderBy} = '${ListingStatus.active}' THEN 4 WHEN ${orderByCondition.orderBy} = '${ListingStatus.closed}' THEN 5 END`
: `CASE WHEN ${orderByCondition.orderBy} = '${ListingStatus.closed}' THEN 1 WHEN ${orderByCondition.orderBy} = '${ListingStatus.active}' THEN 2 WHEN ${orderByCondition.orderBy} = '${ListingStatus.pending}' THEN 3 WHEN ${orderByCondition.orderBy} = '${ListingStatus.changesRequested}' THEN 4 WHEN ${orderByCondition.orderBy} = '${ListingStatus.pendingReview}' THEN 5 END`
this.addOrderBy(orderStr)
this.addOrderBy("listings.applicationDueDate", orderByCondition.orderDir)
} else {
Expand Down

0 comments on commit 00eca07

Please sign in to comment.