-
Notifications
You must be signed in to change notification settings - Fork 14
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
#2001 - Changes to handle PD PPD Part 2 #2121
Conversation
expect(ppdReceivedStudent.disabilityStatus).toBe(DisabilityStatus.PPD); | ||
expect( | ||
formatDate(ppdReceivedStudent.studentPDUpdateAt, ATBC_DATE_FORMAT), | ||
).toBe(ppdResponse.D8Y_DTE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done 👍
@@ -8,5 +8,6 @@ export class CleanDatabase { | |||
async cleanDatabase(): Promise<void> { | |||
// Drops the database and all its data.It will erase all your database tables and their data. | |||
await this.dataSource.dropDatabase(); | |||
await this.dataSource.query("DROP EXTENSION pg_trgm"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to have something like this below ? to avoid errors if the extension is not exists?
await dataSource.query("DROP EXTENSION IF EXISTS pg_trgm");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get your point @guru-aot . But we devs recently decided to stop using the IF EXISTS
and ID NOT EXISTS
to be aware of the side effects and handle them. That was the reason why I avoided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get that @dheepak-aot, I am not going to stress on this but for this exceptional scenario, I was validating if we need it or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a decision to stop using the IF EXISTS
for migrations because it is a controlled script execution where the up/down must be precise and if it is changing something the changed item (column/index/whatever) should be there.
For this situation, the same may not be applied, for instance, if executing the clean database
twice will make the second execution fail.
.../schedulers/atbc-respone-integration/_tests_/atbc-response-integration.scheduler.e2e-spec.ts
Outdated
Show resolved
Hide resolved
.../schedulers/atbc-respone-integration/_tests_/atbc-response-integration.scheduler.e2e-spec.ts
Outdated
Show resolved
Hide resolved
lastName: string; | ||
birthDate: Date; | ||
disabilityStatus: DisabilityStatus; | ||
disabilityStatusUpdatedDate: Date; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asking this again for clarification, the disabilityStatusUpdatedDate is an replacement of both created and updated date right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The disabilityStatusUpdatedDate
is the property which is intended to update the pd_date_update
eventually.
Both created and updated date still exist and we are not removing them now as a part of the ticket.
.../schedulers/atbc-respone-integration/_tests_/atbc-response-integration.scheduler.e2e-spec.ts
Outdated
Show resolved
Hide resolved
@@ -8,5 +8,6 @@ export class CleanDatabase { | |||
async cleanDatabase(): Promise<void> { | |||
// Drops the database and all its data.It will erase all your database tables and their data. | |||
await this.dataSource.dropDatabase(); | |||
await this.dataSource.query("DROP EXTENSION pg_trgm"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
sources/packages/backend/libs/integrations/src/services/atbc/atbc.service.ts
Outdated
Show resolved
Hide resolved
})); | ||
let updatedDisabilityStatusCount = 0; | ||
this.logger.log( | ||
`Processing disability status requests for ${studentsToUpdate.length} students`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a suggestion, not a show stopper or part of your PR, to handle, both the variety of logs generated below:
Processing disability status requests for 1 student
Processing disability status requests for 2 students
It would be better to have the student(s) in the logger.
sources/packages/backend/libs/integrations/src/services/atbc/atbc.service.ts
Outdated
Show resolved
Hide resolved
id: number; | ||
sin: string; | ||
} | ||
export const ATBC_DATE_FORMAT = "YYYY/MM/DD"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please explain, why we are not having the ATBC_DATE_FORMAT const in the backend/libs/utilities/src/date-utils.ts? Is there a reason, that it is created here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...ckages/backend/libs/integrations/src/atbc-integration/atbc-integration.processing.service.ts
Outdated
Show resolved
Hide resolved
...ckages/backend/libs/integrations/src/atbc-integration/atbc-integration.processing.service.ts
Show resolved
Hide resolved
...ckages/backend/libs/integrations/src/atbc-integration/atbc-integration.processing.service.ts
Show resolved
Hide resolved
...ckages/backend/libs/integrations/src/atbc-integration/atbc-integration.processing.service.ts
Outdated
Show resolved
Hide resolved
* @param birthDate birth date. | ||
* @returns student. | ||
*/ | ||
async getStudentBySINAndLastNameAndBirthDate( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO just a suggestion, the method name can be called as findStudentByPersonalInfo or getStudentByPersonalInfo. seems to be a big method name with 2 ANDs
export function createFakeStudent(user?: User): Student { | ||
export function createFakeStudent( | ||
user?: User, | ||
options?: { initialValue: Partial<Student> }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great to see the methods createFakeStudent and saveFakeStudent are enhancing like anything with the functionalities we create.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with review, very minor comments and doubts. Please have a look.
sources/packages/backend/libs/integrations/src/services/student/student.service.ts
Show resolved
Hide resolved
...ckages/backend/libs/integrations/src/atbc-integration/atbc-integration.processing.service.ts
Outdated
Show resolved
Hide resolved
...ckages/backend/libs/integrations/src/atbc-integration/atbc-integration.processing.service.ts
Outdated
Show resolved
Hide resolved
...ckages/backend/libs/integrations/src/atbc-integration/atbc-integration.processing.service.ts
Show resolved
Hide resolved
...ces/packages/backend/libs/integrations/src/atbc-integration/models/atbc-integration.model.ts
Show resolved
Hide resolved
sources/packages/backend/libs/integrations/src/services/atbc/atbc.service.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work @dheepak-aot. added some comments
@@ -37,17 +36,11 @@ export class ATBCResponseIntegrationScheduler extends BaseScheduler<void> { | |||
appLogger: this.logger, | |||
jobLogger: job, | |||
}); | |||
await summary.info("Processing PD status for students."); | |||
await summary.info("Processing disability status for students."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing the changes @dheepak-aot 👍 Looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice work @dheepak-aot
Handle PD PPD requests Part 2
pg_trgm
package already exists. Hence in data seed cleanup added a script to remove the package during delete database.