Skip to content

Commit

Permalink
fix: 마감임박순에 전형일 없는 것 가장 후순위로 이동 (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
shindong96 authored Aug 20, 2024
1 parent 50e76fb commit d3c1aef
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,13 @@ private NumberExpression<Integer> sortByProcessType() {

private OrderSpecifier<?>[] sortByEndDate(LocalDateTime today) {
// 마감이 지나지 않은 경우 (schedule이 today 이후)
long order = 0L;
NumberExpression<Long> notExpiredCase = new CaseBuilder()
.when(applicationProcessJpaEntity.schedule.after(today)).then(0L)
.otherwise(1L);
.when(applicationProcessJpaEntity.schedule.eq(today)).then(order++)
.when(applicationProcessJpaEntity.schedule.after(today)).then(order++)
.when(applicationProcessJpaEntity.schedule.before(today)).then(order++)
.when(applicationProcessJpaEntity.schedule.isNull()).then(order++)
.otherwise(order);

// 마감이 임박한 순서로 정렬 (notExpiredCase 오름차순, schedule 오름차순)
OrderSpecifier<Long> notExpiredOrder = notExpiredCase.asc();
Expand Down

0 comments on commit d3c1aef

Please sign in to comment.