diff --git a/backend/core/src/listings/db/listing-query-builder.ts b/backend/core/src/listings/db/listing-query-builder.ts index c86c1497d9..8b18a07923 100644 --- a/backend/core/src/listings/db/listing-query-builder.ts +++ b/backend/core/src/listings/db/listing-query-builder.ts @@ -54,8 +54,8 @@ export class ListingsQueryBuilder extends SelectQueryBuilder { 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 {