Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Fixes #982

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ <h6>Documents needed for this step:</h6>
required
placeholder="Type size in hectares"
[formControlName]="i + '-size'"
(change)="onChangeLotSize()"
(change)="onChangeLotSize(i, $event)"
/>
<span *ngIf="element.size" matTextSuffix>ha</span>
</mat-form-field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ export class SubdProposalComponent extends FilesStepComponent implements OnInit,
this.calculateLotSize();
}

onChangeLotSize() {
onChangeLotSize(i: number, event: Event) {
const target = event.target as HTMLInputElement;
this.proposedLots[i].size = target.value;
this.calculateLotSize();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
flex-direction: column;
align-items: start;

button {
div, button {
margin-top: rem(4);
width: 100%;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import { ApplicationDecisionV1Service } from './application-decision/application
exports: [
ApplicationModificationService,
ApplicationDecisionV1Service,
ApplicationDecisionMeetingService,
ApplicationReconsiderationService,
],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { ApplicationDecision } from '../../application-decision/application-decision.entity';
import { ApplicationDecisionModule } from '../../application-decision/application-decision.module';
import { ApplicationModification } from '../../application-decision/application-modification/application-modification.entity';
import { ApplicationReconsideration } from '../../application-decision/application-reconsideration/application-reconsideration.entity';
import { ApplicationSubmissionStatusModule } from '../application-submission-status/application-submission-status.module';
Expand All @@ -19,6 +20,7 @@ import { ApplicationTimelineService } from './application-timeline.service';
]),
ApplicationModule,
ApplicationSubmissionStatusModule,
ApplicationDecisionModule,
],
providers: [ApplicationTimelineService],
controllers: [ApplicationTimelineController],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { createMock, DeepMocked } from '@golevelup/nestjs-testing';
import { Test, TestingModule } from '@nestjs/testing';
import { getRepositoryToken } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { ApplicationDecisionMeeting } from '../../application-decision/application-decision-v1/application-decision-meeting/application-decision-meeting.entity';
import { ApplicationDecisionMeetingService } from '../../application-decision/application-decision-v1/application-decision-meeting/application-decision-meeting.service';
import { ApplicationDecision } from '../../application-decision/application-decision.entity';
import { ApplicationModificationOutcomeType } from '../../application-decision/application-modification/application-modification-outcome-type/application-modification-outcome-type.entity';
import { ApplicationModification } from '../../application-decision/application-modification/application-modification.entity';
Expand Down Expand Up @@ -29,6 +31,7 @@ describe('ApplicationTimelineService', () => {
let mockAppService: DeepMocked<ApplicationService>;
let mockAppMeetingService: DeepMocked<ApplicationMeetingService>;
let mockAppStatusService: DeepMocked<ApplicationSubmissionStatusService>;
let mockAppDecMeetingService: DeepMocked<ApplicationDecisionMeetingService>;
const mockSameDate = new Date();

beforeEach(async () => {
Expand All @@ -39,6 +42,7 @@ describe('ApplicationTimelineService', () => {
mockAppService = createMock();
mockAppMeetingService = createMock();
mockAppStatusService = createMock();
mockAppDecMeetingService = createMock();

const module: TestingModule = await Test.createTestingModule({
providers: [
Expand Down Expand Up @@ -70,6 +74,10 @@ describe('ApplicationTimelineService', () => {
provide: ApplicationSubmissionStatusService,
useValue: mockAppStatusService,
},
{
provide: ApplicationDecisionMeetingService,
useValue: mockAppDecMeetingService,
},
ApplicationTimelineService,
],
}).compile();
Expand All @@ -86,6 +94,7 @@ describe('ApplicationTimelineService', () => {
mockAppDecisionRepo.find.mockResolvedValue([]);
mockAppMeetingService.getByAppFileNumber.mockResolvedValue([]);
mockAppStatusService.getStatusesByFileNumber.mockResolvedValue([]);
mockAppDecMeetingService.getByAppFileNumber.mockResolvedValue([]);
});

it('should be defined', () => {
Expand Down Expand Up @@ -255,6 +264,27 @@ describe('ApplicationTimelineService', () => {
expect(res[0].htmlText).toEqual('CATS #2 Report Sent to Applicant');
});

it('should map Decision Meeting Events', async () => {
const sameDate = new Date();
mockAppDecMeetingService.getByAppFileNumber.mockResolvedValue([
new ApplicationDecisionMeeting({
date: sameDate,
}),
new ApplicationDecisionMeeting({
date: new Date(sameDate.getTime() + 5),
}),
]);

const res = await service.getTimelineEvents('file-number');

expect(res).toBeDefined();
expect(res.length).toEqual(2);
expect(res[1].htmlText).toEqual(
'Review Discussion #1 - <strong>Under Review by ALC</strong>',
);
expect(res[0].htmlText).toEqual('Review Discussion #2');
});

it('should map Status Events', async () => {
const sameDate = new Date();
mockAppStatusService.getStatusesByFileNumber.mockResolvedValue([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { ApplicationDecisionMeetingService } from '../../application-decision/application-decision-v1/application-decision-meeting/application-decision-meeting.service';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct that you are using decision version 1 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this meeting service is only in V1 but will be used even once we move to Decision V2.

import { ApplicationDecision } from '../../application-decision/application-decision.entity';
import { ApplicationModification } from '../../application-decision/application-modification/application-modification.entity';
import { ApplicationReconsideration } from '../../application-decision/application-reconsideration/application-reconsideration.entity';
Expand Down Expand Up @@ -56,6 +57,7 @@ export class ApplicationTimelineService {
private applicationDecisionRepo: Repository<ApplicationDecision>,
private applicationService: ApplicationService,
private applicationMeetingService: ApplicationMeetingService,
private appDecMeetingService: ApplicationDecisionMeetingService,
private applicationSubmissionStatusService: ApplicationSubmissionStatusService,
) {}

Expand Down Expand Up @@ -326,11 +328,11 @@ export class ApplicationTimelineService {
}

private async addMeetingEvents(
noticeOfIntent: Application,
application: Application,
events: TimelineEvent[],
) {
const meetings = await this.applicationMeetingService.getByAppFileNumber(
noticeOfIntent.fileNumber,
application.fileNumber,
);

meetings.sort(
Expand Down Expand Up @@ -372,6 +374,28 @@ export class ApplicationTimelineService {

typeCount.set(meeting.type.code, count + 1);
});

const discussionMeetings =
await this.appDecMeetingService.getByAppFileNumber(
application.fileNumber,
);

discussionMeetings.sort((a, b) => a.date.getTime() - b.date.getTime());

discussionMeetings.forEach((meeting, index) => {
let htmlText = `Review Discussion #${index + 1}`;

if (index === 0) {
htmlText += ' - <strong>Under Review by ALC</strong>';
}

events.push({
htmlText,
startDate: meeting.date.getTime() + SORTING_ORDER.VISIT_REPORTS,
fulfilledDate: null,
isFulfilled: true,
});
});
}

private async addStatusEvents(
Expand All @@ -388,7 +412,7 @@ export class ApplicationTimelineService {
![
SUBMISSION_STATUS.IN_REVIEW_BY_ALC,
SUBMISSION_STATUS.ALC_DECISION,
].includes(<SUBMISSION_STATUS.IN_REVIEW_BY_ALC>status.statusType.code),
].includes(<SUBMISSION_STATUS>status.statusType.code),
);
for (const status of statusesToInclude) {
if (status.effectiveDate) {
Expand Down