Skip to content

Commit

Permalink
Merge pull request #1800 from bcgov/hotfix/ALCS-2166
Browse files Browse the repository at this point in the history
Fix ALCS Advanced Search "Date Range" Results Bugs
  • Loading branch information
Abradat authored Aug 12, 2024
2 parents 6045964 + b0a9b8d commit 94a9fa5
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 15 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 @@ -11,6 +11,7 @@ import { LocalGovernment } from '../../local-government/local-government.entity'
import { SEARCH_CACHE_TIME } from '../search.config';
import { AdvancedSearchResultDto, SearchRequestDto } from '../search.dto';
import { InquirySearchView } from './inquiry-search-view.entity';
import { getNextDayToPacific, getStartOfDayToPacific } from '../../../utils/pacific-date-time-helper';

@Injectable()
export class InquiryAdvancedSearchService {
Expand Down Expand Up @@ -284,16 +285,20 @@ export class InquiryAdvancedSearchService {
query = query.andWhere(
'inquiry.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(
'inquiry.date_submitted_to_alc <= :date_submitted_to',
'inquiry.date_submitted_to_alc < :date_submitted_to',
{
date_submitted_to: new Date(searchDto.dateSubmittedTo),
date_submitted_to: getNextDayToPacific(
searchDto.dateSubmittedTo
).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
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,17 @@ export class PlanningReviewAdvancedSearchService {

if (searchDto.dateSubmittedFrom !== undefined) {
query.andWhere('referral.submission_date >= :date_submitted_from', {
date_submitted_from: new Date(searchDto.dateSubmittedFrom),
date_submitted_from: getStartOfDayToPacific(
searchDto.dateSubmittedFrom
).toISOString(),
});
}

if (searchDto.dateSubmittedTo !== undefined) {
query.andWhere('referral.submission_date <= :date_submitted_to', {
date_submitted_to: new Date(searchDto.dateSubmittedTo),
query.andWhere('referral.submission_date < :date_submitted_to', {
date_submitted_to: getNextDayToPacific(
searchDto.dateSubmittedTo
).toISOString(),
});
}
promises.push(query.getMany());
Expand Down Expand Up @@ -318,7 +322,7 @@ export class PlanningReviewAdvancedSearchService {
}

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

0 comments on commit 94a9fa5

Please sign in to comment.