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

#1837 - Fix missing details on submitting Designation Request #1848

Merged
merged 6 commits into from
Mar 30, 2023

Conversation

sh16011993
Copy link
Collaborator

The following was fixed as a part of this PR:

  • Private Institution User

When the private institution user submits a Designation Request as below:

image

The Pending and the Approved Designation Request can be viewed by the institution user with all the details properly populated.

image

When the ministry user logs in to approve this Designation Request, they can see all the details related to the Designation Request being properly populated.

image

  • Public Institution User

For the public institution user, verified that their Designation Request View remains as before.

image

@sh16011993 sh16011993 added Bug Something isn't working User Experience task that relates to UI UX SIMS-Api SIMS-Api labels Mar 29, 2023
@sh16011993 sh16011993 self-assigned this Mar 29, 2023
@sh16011993 sh16011993 changed the title #1837 - Fixed the Designation Request bug #1837 - Fix missing details on submitting Designation Request Mar 29, 2023
@dheepak-aot
Copy link
Collaborator

Nice work @sh16011993 . As @andrewsignori-aot mentioned, making submitted_data as nullable is better than {}.

Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot left a comment

Choose a reason for hiding this comment

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

Nice work, please take a look in the comments.

* @returns Institution retrieved, if found, otherwise returns null.
*/
async getInstitutionTypeById(institutionId: number): Promise<Institution> {
return this.repo.findOne({
Copy link
Collaborator

Choose a reason for hiding this comment

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

if the where is just an id, we can use findonebyId instead of findOne, just a suggestion

Copy link
Collaborator

Choose a reason for hiding this comment

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

findOneById is marked as deprecated. The one to be used instead would be findOneBy but it does not seem to have the select options only the where

findOneBy(where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<Entity | null>

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes just check its deprecated, yes we can use findOneBy but in this scenario, its kind of selects everything. I am okay to have it as it is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In that case, I will leave it as it is.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The findOneBy here wouldn't bring the institutionType. AFAIK findOneBy doesn't allow you to specify the relations.

Copy link
Contributor

@ann-aot ann-aot left a comment

Choose a reason for hiding this comment

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

Good work @sh16011993 . same comments as that @andrewsignori-aot . Curious to know, how it worked before. do you have any idea? did we remove the IsBcprivate from dry run payload or is it something else

@sh16011993 sh16011993 added the DB DB migration involved label Mar 29, 2023
@sh16011993
Copy link
Collaborator Author

sh16011993 commented Mar 29, 2023

Good work @sh16011993 . same comments as that @andrewsignori-aot . Curious to know, how it worked before. do you have any idea? did we remove the IsBcprivate from dry run payload or is it something else

We have added isBCPrivate to the payload for all the designation requests now. It worked just once when we were discussing during our call. I am also curious about the part that if isBCPrivate has default value as true, then it should be taken up as true by the formio API when it validates the form and thus should return the dynamicData in cases when isBCPrivate is not passed explicitly to the payload. @andrewsignori-aot @dheepak-aot Any suggestions?

Copy link
Collaborator

@andrepestana-aot andrepestana-aot left a comment

Choose a reason for hiding this comment

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

Great job! I left a comment.

@@ -81,6 +86,13 @@ export class DesignationAgreementInstitutionsController extends BaseController {
"User does not have the rights to create a designation agreement.",
);
}

// Check if institution is private or public and append it to the payload
payload.isBCPrivate =
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that the comment sounds like there are only those 2 types: public and private but we're checking if it is "BC Private", right? It can be a private "International" institution.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

AFAIK, it is private vs "other types". Updated my comment line in the code

* @returns Institution retrieved, if found, otherwise returns null.
*/
async getInstitutionTypeById(institutionId: number): Promise<Institution> {
return this.repo.findOne({
Copy link
Collaborator

Choose a reason for hiding this comment

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

The findOneBy here wouldn't bring the institutionType. AFAIK findOneBy doesn't allow you to specify the relations.

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
getSQLFileData(
"Update-col-submitted_data-drop-not-null.sql",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor thing. We never use _ for sql file names. (I saw there is only one file which is exceptional).

Copy link
Collaborator Author

@sh16011993 sh16011993 Mar 30, 2023

Choose a reason for hiding this comment

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

fixed

Copy link
Collaborator

@dheepak-aot dheepak-aot left a comment

Choose a reason for hiding this comment

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

Looks good @sh16011993 . Just one minor comment.

@@ -81,6 +86,13 @@ export class DesignationAgreementInstitutionsController extends BaseController {
"User does not have the rights to create a designation agreement.",
);
}

// Check if institution is private and append it to the payload
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add the period to the end of sentences.

* @param institutionId is the institution id.
* @returns boolean true if institution is private, else false.
*/
async checkIfInstitutionIsPrivate(institutionId: number): Promise<boolean> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a minor change that I missed in the previous review, a method like this usually will be named as isPrivateInstitution, IMO.

Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot Mar 30, 2023

Choose a reason for hiding this comment

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

Please adjust also the entity model to reflect the DB change. If possible change the any to unknown unless it causes side effects.

image

Copy link
Collaborator

@guru-aot guru-aot left a comment

Choose a reason for hiding this comment

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

LGTM, nice work @sh16011993

Copy link
Contributor

@ann-aot ann-aot left a comment

Choose a reason for hiding this comment

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

Good work @sh16011993 👍

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions
Copy link

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 18.01% ( 1957 / 10865 )
Methods: 8.14% ( 115 / 1413 )
Lines: 20.71% ( 1713 / 8271 )
Branches: 10.92% ( 129 / 1181 )

@github-actions
Copy link

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 32.41% ( 176 / 543 )
Methods: 21.25% ( 17 / 80 )
Lines: 39.25% ( 157 / 400 )
Branches: 3.17% ( 2 / 63 )

@github-actions
Copy link

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 56.72% ( 308 / 543 )
Methods: 46.38% ( 32 / 69 )
Lines: 59.48% ( 276 / 464 )
Branches: 0% ( 0 / 10 )

@github-actions
Copy link

E2E SIMS API Coverage Report

Totals Coverage
Statements: 38.02% ( 2562 / 6738 )
Methods: 29.73% ( 261 / 878 )
Lines: 43.63% ( 2193 / 5026 )
Branches: 12.95% ( 108 / 834 )

Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@sh16011993 sh16011993 merged commit 25c01c4 into main Mar 30, 2023
@sh16011993 sh16011993 temporarily deployed to DEV March 30, 2023 21:36 — with GitHub Actions Inactive
@sh16011993 sh16011993 deleted the 1837_designation_request_returns_missing_details branch March 30, 2023 21:36
@sh16011993 sh16011993 temporarily deployed to DEV March 30, 2023 21:36 — with GitHub Actions Inactive
guru-aot pushed a commit that referenced this pull request Mar 30, 2023
* #1837 - Fixed the Designation Request bug

* Update code with review comments

* Updated code with review comments

* Updated code with review comments

* Updated code with review comments

* Updated code with the review comments
@sh16011993 sh16011993 temporarily deployed to DEV March 30, 2023 21:50 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working DB DB migration involved SIMS-Api SIMS-Api User Experience task that relates to UI UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants