Skip to content

Commit

Permalink
Fix ALCS advance search date range bugs for Applications, NOIs, and SRWs
Browse files Browse the repository at this point in the history
  • Loading branch information
Abradat committed Aug 12, 2024
1 parent 6045964 commit 78ee27b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export class ApplicationAdvancedSearchService {
}

if (searchDto.dateSubmittedTo !== undefined) {
query.andWhere('app.date_submitted_to_alc <= :date_submitted_to', {
query.andWhere('app.date_submitted_to_alc < :date_submitted_to', {
date_submitted_to: getNextDayToPacific(
searchDto.dateSubmittedTo,
).toISOString(),
Expand Down Expand Up @@ -300,7 +300,7 @@ export class ApplicationAdvancedSearchService {
}

if (searchDto.dateDecidedTo) {
query.andWhere('decision.date <= :decision_date_to', {
query.andWhere('decision.date < :decision_date_to', {
decision_date_to: getNextDayToPacific(
searchDto.dateDecidedTo,
).toISOString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export class NoticeOfIntentAdvancedSearchService {
{
date_submitted_from: getStartOfDayToPacific(
searchDto.dateSubmittedFrom,
),
).toISOString(),
},
);
}
Expand All @@ -298,7 +298,7 @@ export class NoticeOfIntentAdvancedSearchService {
{
date_submitted_to: getNextDayToPacific(
searchDto.dateSubmittedTo,
),
).toISOString(),
},
);
}
Expand Down Expand Up @@ -327,7 +327,7 @@ export class NoticeOfIntentAdvancedSearchService {
}

if (searchDto.dateDecidedTo) {
query = query.andWhere('decision.date <= :decision_date_to', {
query = query.andWhere('decision.date < :decision_date_to', {
decision_date_to: getNextDayToPacific(
searchDto.dateDecidedTo,
).toISOString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Notification } from '../../notification/notification.entity';
import { SEARCH_CACHE_TIME } from '../search.config';
import { AdvancedSearchResultDto, SearchRequestDto } from '../search.dto';
import { NotificationSubmissionSearchView } from './notification-search-view.entity';
import { getNextDayToPacific, getStartOfDayToPacific } from '../../../utils/pacific-date-time-helper';

@Injectable()
export class NotificationAdvancedSearchService {
Expand Down Expand Up @@ -210,16 +211,20 @@ export class NotificationAdvancedSearchService {
query = query.andWhere(
'notification.date_submitted_to_alc >= :date_submitted_from',
{
date_submitted_from: new Date(searchDto.dateSubmittedFrom),
date_submitted_from: getStartOfDayToPacific(
searchDto.dateSubmittedFrom
).toISOString(),
},
);
}

if (searchDto.dateSubmittedTo !== undefined) {
query = query.andWhere(
'notification.date_submitted_to_alc <= :date_submitted_to',
'notification.date_submitted_to_alc < :date_submitted_to',
{
date_submitted_to: new Date(searchDto.dateSubmittedTo),
date_submitted_to: getNextDayToPacific(
searchDto.dateSubmittedTo
).toISOString(),
},
);
}
Expand Down

0 comments on commit 78ee27b

Please sign in to comment.