Skip to content

Commit

Permalink
chore: updating computed col based on awaiting approval or not
Browse files Browse the repository at this point in the history
  • Loading branch information
gurjmatharu authored and dleard committed Sep 12, 2023
1 parent 4051edf commit 867671f
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ additional_funding_sources_sum as
select
sum(case when status = 'Approved' then amount::numeric
when status = 'Denied' then 0
when status = 'Awaiting Approval' then 0
end) as total
from additional_funding_sources
),
check_awaiting_approval as
(
select
case when exists (select 1 from additional_funding_sources where status = 'Awaiting Approval')
then 1 else 0 end as awaiting_approval
)
select
case
Expand All @@ -30,6 +35,8 @@ select
($1.new_form_data ->> 'proponentCost')::numeric IS NULL
OR
($1.new_form_data ->> 'maxFundingAmount')::numeric IS NULL
OR
(select awaiting_approval from check_awaiting_approval) = 1
) THEN NULL
else
(
Expand Down

0 comments on commit 867671f

Please sign in to comment.