Skip to content

Commit

Permalink
Merge pull request #1836 from bcgov/bugfix/ALCS-2234
Browse files Browse the repository at this point in the history
Fix "For Discussion" Column Showing the Furthest Date Instead of Closest
  • Loading branch information
Abradat authored Sep 9, 2024
2 parents e59c435 + 1e1b157 commit 79fc293
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,17 @@ export class ApplicationDecisionMeetingService {
> {
return await this.appDecisionMeetingRepository
.createQueryBuilder('meeting')
.select('reconsideration.uuid, MAX(meeting.date) as next_meeting')
.select('reconsideration.uuid', 'uuid')
.addSelect(
`
CASE
WHEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE) THEN meeting.date END) is NOT NULL
THEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE) THEN meeting.date END)
ELSE MAX(CASE WHEN meeting.date < (CURRENT_DATE) THEN meeting.date END)
END
`,
'next_meeting',
)
.innerJoin('meeting.application', 'application')
.innerJoin('application.reconsiderations', 'reconsideration')
.innerJoin('reconsideration.card', 'card')
Expand All @@ -145,7 +155,17 @@ export class ApplicationDecisionMeetingService {
> {
return await this.appDecisionMeetingRepository
.createQueryBuilder('meeting')
.select('application.uuid, MAX(meeting.date) as next_meeting')
.select('application.uuid', 'uuid')
.addSelect(
`
CASE
WHEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE) THEN meeting.date END) is NOT NULL
THEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE) THEN meeting.date END)
ELSE MAX(CASE WHEN meeting.date < (CURRENT_DATE) THEN meeting.date END)
END
`,
'next_meeting',
)
.innerJoin('meeting.application', 'application')
.innerJoin('application.card', 'card')
.where(`card.status_code != '${CARD_STATUS.DECISION_RELEASED}'`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,17 @@ export class PlanningReviewMeetingService {
> {
return await this.meetingRepository
.createQueryBuilder('meeting')
.select('planningReview.uuid, MAX(meeting.date) as next_meeting')
.select('planningReview.uuid', 'uuid')
.addSelect(
`
CASE
WHEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE) THEN meeting.date END) is NOT NULL
THEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE) THEN meeting.date END)
ELSE MAX(CASE WHEN meeting.date < (CURRENT_DATE) THEN meeting.date END)
END
`,
'next_meeting',
)
.innerJoin('meeting.planningReview', 'planningReview')
.innerJoin('planningReview.referrals', 'referrals')
.innerJoin('referrals.card', 'card')
Expand Down

0 comments on commit 79fc293

Please sign in to comment.