Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working on updates to the JHU grant database SQL for Fibi, I realized an issue with the current SQL executing against Coeus. Luckily the impact is small.
The current SQL selects all records for a grant if one of the records has been updated if the last update timestamp is greater than the supplied filter timestamp. The issue was the set of grant records returned need to be only those with a Proposal Status of Funded. But with the current SQL, it was possible that grant records with Proposal Status of some other value would return too.
I fixed this issue by adding the
AND A.PROPOSAL_STATUS = 'Funded'
to the main SQL so only Funded grant records are returned.The changes related to checking
GRANT_NUMBER IS NOT NULL
are also needed to ensure we don't get any records with NULL grant number. Turned out I had wrong the alias inside the EXISTS statement, but that actually works out in the end. But I changed the SQL to check in the EXISTS on the EXISTS alias and the outer query view as well to be complete and more understandable.I did analysis since this SQL was deployed on 2024-03-28, and luckily there are only three records that were returned with a non-Funded Proposal Status for two grants. There were no records returned with a NULL GRANT_NUMBER. When this change is deployed in PROD, I will backdate to 2024-03-28 and run the grant loader to clean up the two grants.