-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3637 from bcgov/NDT-571-empty-ccbc-summary-data-e…
…ven-if-a-sow-seems-to-be-uploaded-in-project-section fix: add application id when archiving
- Loading branch information
Showing
10 changed files
with
129 additions
and
8 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
-- Deploy ccbc:mutations/archive_application_sow to pg | ||
|
||
begin; | ||
|
||
drop function if exists ccbc_public.archive_application_sow; | ||
|
||
create or replace function ccbc_public.archive_application_sow(_amendment_number int) | ||
returns void as $$ | ||
declare | ||
sow_data_ids int[]; | ||
sow_data_id int; | ||
begin | ||
-- Select all the IDs that belong to the application_id | ||
sow_data_ids := array( | ||
select sd.id | ||
from ccbc_public.application_sow_data as sd | ||
where sd.amendment_number = _amendment_number | ||
); | ||
|
||
-- Update archived_at for non-archived records in application_sow_data table | ||
update ccbc_public.application_sow_data | ||
set archived_at = now() | ||
where amendment_number = _amendment_number | ||
and archived_at is null; | ||
|
||
-- Loop through the selected IDs | ||
foreach sow_data_id in array sow_data_ids loop | ||
-- Update archived_at on all the tabs for the current sow_data_id if it is null | ||
update ccbc_public.sow_tab_1 | ||
set archived_at = now() | ||
where sow_id = sow_data_id | ||
and archived_at is null; | ||
|
||
update ccbc_public.sow_tab_2 | ||
set archived_at = now() | ||
where sow_id = sow_data_id | ||
and archived_at is null; | ||
|
||
update ccbc_public.sow_tab_7 | ||
set archived_at = now() | ||
where sow_id = sow_data_id | ||
and archived_at is null; | ||
|
||
update ccbc_public.sow_tab_8 | ||
set archived_at = now() | ||
where sow_id = sow_data_id | ||
and archived_at is null; | ||
end loop; | ||
end; | ||
$$ language plpgsql volatile; | ||
|
||
grant execute on function ccbc_public.archive_application_sow to ccbc_analyst; | ||
grant execute on function ccbc_public.archive_application_sow to ccbc_admin; | ||
|
||
commit; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
-- Deploy ccbc:mutations/archive_application_sow to pg | ||
|
||
begin; | ||
|
||
drop function if exists ccbc_public.archive_application_sow; | ||
|
||
create or replace function ccbc_public.archive_application_sow(_application_id int) | ||
returns void as $$ | ||
declare | ||
sow_data_ids int[]; | ||
sow_data_id int; | ||
begin | ||
-- Select all the IDs that belong to the application_id | ||
sow_data_ids := array( | ||
select sd.id | ||
from ccbc_public.application_sow_data as sd | ||
where sd.application_id = _application_id | ||
); | ||
|
||
-- Update archived_at for non-archived records in application_sow_data table | ||
update ccbc_public.application_sow_data | ||
set archived_at = now() | ||
where application_id = _application_id | ||
and archived_at is null; | ||
|
||
-- Loop through the selected IDs | ||
foreach sow_data_id in array sow_data_ids loop | ||
-- Update archived_at on all the tabs for the current sow_data_id if it is null | ||
update ccbc_public.sow_tab_1 | ||
set archived_at = now() | ||
where sow_id = sow_data_id | ||
and archived_at is null; | ||
|
||
update ccbc_public.sow_tab_2 | ||
set archived_at = now() | ||
where sow_id = sow_data_id | ||
and archived_at is null; | ||
|
||
update ccbc_public.sow_tab_7 | ||
set archived_at = now() | ||
where sow_id = sow_data_id | ||
and archived_at is null; | ||
|
||
update ccbc_public.sow_tab_8 | ||
set archived_at = now() | ||
where sow_id = sow_data_id | ||
and archived_at is null; | ||
end loop; | ||
end; | ||
$$ language plpgsql volatile; | ||
|
||
grant execute on function ccbc_public.archive_application_sow to ccbc_analyst; | ||
grant execute on function ccbc_public.archive_application_sow to ccbc_admin; | ||
|
||
begin; |
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 |
---|---|---|
|
@@ -718,3 +718,5 @@ tables/application_form_template_9_data 2024-09-25T22:50:17Z Rafael Solorzano <6 | |
@1.203.0 2024-10-25T16:54:48Z CCBC Service Account <[email protected]> # release v1.203.0 | ||
@1.203.1 2024-10-28T19:01:53Z CCBC Service Account <[email protected]> # release v1.203.1 | ||
@1.203.2 2024-10-29T17:37:47Z CCBC Service Account <[email protected]> # release v1.203.2 | ||
mutations/archive_application_sow [mutations/[email protected]] 2024-10-24T19:57:11Z Anthony Bushara <[email protected]> # Add application ID to prevent archiving other applications | ||
@1.203.3 2024-10-29T21:17:39Z CCBC Service Account <[email protected]> # release v1.203.3 |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "CONN-CCBC-portal", | ||
"version": "1.203.2", | ||
"version": "1.203.3", | ||
"main": "index.js", | ||
"repository": "https://github.com/bcgov/CONN-CCBC-portal.git", | ||
"author": "Romer, Meherzad CITZ:EX <[email protected]>", | ||
|