Skip to content

Commit

Permalink
fix: sort table with listings approval statuses (#3622)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyjablonski authored Aug 29, 2023
1 parent fec1a12 commit 5cdf793
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 5cdf793

Please sign in to comment.