-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…3374) ### As a part of this PR, the following were completed: - **Wrote the following e2e test:** ReportAestController(e2e)-exportReport √ Should generate the Institution Designation report when a report generation request is made with the appropriate date range filters. **Note:** There is a code refactor for `saveFakeDesignationAgreementLocation`. - Fix for the ministry reports dropdown that was getting cut off because of CSS style set to `overflow: hidden`. Changed the style to `overflow: visible`. - SQL query fix fetching the Institution Designation Report. The fix involves ensuring that the `startDate` and the `endDate` are appropriately converted to UTC ensuring that the comparison for these date range filters happens correctly as the values saved in the database for the `assessedDate` and the `endDate` columns are in UTC. **SQL Query:** ```sql SELECT institutions.operating_name AS "Institution Operating Name", institution_locations.name AS "Location Name", institution_locations.institution_code AS "Location Code", institution_type.name AS "Institution Type", designation_agreements.designation_status AS "Designation Status", CAST( CAST(designation_agreements.assessed_date AS date) AS varchar ) AS "Assessed Date", CAST(designation_agreements.end_date AS varchar) AS "Expiry Date", designation_agreement_locations.requested AS "Request for designation", designation_agreement_locations.approved AS "Approved for designation", CONCAT( institution_locations.primary_contact ->> 'firstName', ' ', institution_locations.primary_contact ->> 'lastName' ) AS "Location Contact", institution_locations.primary_contact ->> 'email' AS "Contact Email" FROM sims.institution_locations institution_locations INNER JOIN sims.institutions institutions ON institution_locations.institution_id = institutions.id INNER JOIN sims.institution_type institution_type ON institution_type.id = institutions.institution_type_id INNER JOIN sims.designation_agreement_locations designation_agreement_locations ON designation_agreement_locations.location_id = institution_locations.id INNER JOIN sims.designation_agreements designation_agreements ON designation_agreements.id = designation_agreement_locations.designation_agreement_id WHERE ( designation_agreements.assessed_date >= CAST(:startDate as timestamptz) AND designation_agreements.assessed_date < CAST(:endDate as timestamptz) + INTERVAL ''1 DAY'' ) OR ( designation_agreements.end_date >= CAST(:startDate as timestamptz) AND designation_agreements.end_date < CAST(:endDate as timestamptz) + INTERVAL ''1 DAY'' ) ORDER BY institutions.operating_name ASC, institution_locations.institution_code ASC, designation_agreements.designation_status ASC, designation_agreements.assessed_date DESC, designation_agreements.end_date DESC; ``` ### Screenshot of the e2e test: <img width="1176" alt="image" src="https://github.com/bcgov/SIMS/assets/7859295/842ab8b0-b8d0-4b2b-82ea-a12538e7c6d2"> ### Screenshot for the ministry reports dropdown fix: **Before the fix:** <img width="1920" alt="image" src="https://github.com/bcgov/SIMS/assets/7859295/ac98dbe1-84cd-48ce-a73e-7682381c0644"> ------------------------------------------------------------------------------------------------------------------------- **After the fix:** <img width="1920" alt="image" src="https://github.com/bcgov/SIMS/assets/7859295/15b2914d-cb46-4259-8079-9a00d02d56f4"> --------- Co-authored-by: Andrew Boni Signori <[email protected]>
- Loading branch information
1 parent
62932a0
commit 8f70c75
Showing
9 changed files
with
250 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...end/apps/db-migrations/src/migrations/1717564473617-UpdateInstitutionDesignationReport.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
import { getSQLFileData } from "../utilities/sqlLoader"; | ||
|
||
export class UpdateInstitutionDesignationReport1717564473617 | ||
implements MigrationInterface | ||
{ | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
getSQLFileData("Update-institution-designation-report.sql", "Reports"), | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
getSQLFileData( | ||
"Rollback-update-institution-designation-report.sql", | ||
"Reports", | ||
), | ||
); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...end/apps/db-migrations/src/sql/Reports/Rollback-update-institution-designation-report.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
UPDATE | ||
sims.report_configs | ||
SET | ||
report_sql = ( | ||
'SELECT | ||
institutions.operating_name AS "Institution Operating Name", | ||
institution_locations.name AS "Location Name", | ||
institution_locations.institution_code AS "Location Code", | ||
institution_type.name AS "Institution Type", | ||
designation_agreements.designation_status AS "Designation Status", | ||
CAST( | ||
CAST(designation_agreements.assessed_date AS date) AS varchar | ||
) AS "Assessed Date", | ||
CAST(designation_agreements.end_date AS varchar) AS "Expiry Date", | ||
designation_agreement_locations.requested AS "Request for designation", | ||
designation_agreement_locations.approved AS "Approved for designation", | ||
CONCAT( | ||
institution_locations.primary_contact ->> ''firstName'', | ||
'' '', | ||
institution_locations.primary_contact ->> ''lastName'' | ||
) AS "Location Contact", | ||
institution_locations.primary_contact ->> ''email'' AS "Contact Email" | ||
FROM | ||
sims.institution_locations institution_locations | ||
INNER JOIN sims.institutions institutions ON institution_locations.institution_id = institutions.id | ||
INNER JOIN sims.institution_type institution_type ON institution_type.id = institutions.institution_type_id | ||
INNER JOIN sims.designation_agreement_locations designation_agreement_locations ON designation_agreement_locations.location_id = institution_locations.id | ||
INNER JOIN sims.designation_agreements designation_agreements ON designation_agreements.id = designation_agreement_locations.designation_agreement_id | ||
WHERE | ||
designation_agreements.assessed_date BETWEEN :startDate | ||
AND :endDate | ||
OR designation_agreements.end_date BETWEEN :startDate | ||
AND :endDate | ||
ORDER BY | ||
institutions.operating_name ASC, | ||
institution_locations.institution_code ASC, | ||
designation_agreements.designation_status ASC, | ||
designation_agreements.assessed_date DESC, | ||
designation_agreements.end_date DESC;' | ||
) | ||
WHERE | ||
report_name = 'Institution_Designation_Report'; |
46 changes: 46 additions & 0 deletions
46
...ages/backend/apps/db-migrations/src/sql/Reports/Update-institution-designation-report.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
UPDATE | ||
sims.report_configs | ||
SET | ||
report_sql = ( | ||
'SELECT | ||
institutions.operating_name AS "Institution Operating Name", | ||
institution_locations.name AS "Location Name", | ||
institution_locations.institution_code AS "Location Code", | ||
institution_type.name AS "Institution Type", | ||
designation_agreements.designation_status AS "Designation Status", | ||
CAST( | ||
CAST(designation_agreements.assessed_date AS date) AS varchar | ||
) AS "Assessed Date", | ||
CAST(designation_agreements.end_date AS varchar) AS "Expiry Date", | ||
designation_agreement_locations.requested AS "Request for designation", | ||
designation_agreement_locations.approved AS "Approved for designation", | ||
CONCAT( | ||
institution_locations.primary_contact ->> ''firstName'', | ||
'' '', | ||
institution_locations.primary_contact ->> ''lastName'' | ||
) AS "Location Contact", | ||
institution_locations.primary_contact ->> ''email'' AS "Contact Email" | ||
FROM | ||
sims.institution_locations institution_locations | ||
INNER JOIN sims.institutions institutions ON institution_locations.institution_id = institutions.id | ||
INNER JOIN sims.institution_type institution_type ON institution_type.id = institutions.institution_type_id | ||
INNER JOIN sims.designation_agreement_locations designation_agreement_locations ON designation_agreement_locations.location_id = institution_locations.id | ||
INNER JOIN sims.designation_agreements designation_agreements ON designation_agreements.id = designation_agreement_locations.designation_agreement_id | ||
WHERE | ||
( | ||
designation_agreements.assessed_date >= CAST(:startDate as timestamptz) | ||
AND designation_agreements.assessed_date < CAST(:endDate as timestamptz) + INTERVAL ''1 DAY'' | ||
) | ||
OR ( | ||
designation_agreements.end_date >= CAST(:startDate as timestamptz) | ||
AND designation_agreements.end_date < CAST(:endDate as timestamptz) + INTERVAL ''1 DAY'' | ||
) | ||
ORDER BY | ||
institutions.operating_name ASC, | ||
institution_locations.institution_code ASC, | ||
designation_agreements.designation_status ASC, | ||
designation_agreements.assessed_date DESC, | ||
designation_agreements.end_date DESC;' | ||
) | ||
WHERE | ||
report_name = 'Institution_Designation_Report'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters