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

2962: CAN Summary Card - update funding summary endpoint #3075

Merged
merged 25 commits into from
Dec 2, 2024

Conversation

maiyerlee
Copy link
Contributor

@maiyerlee maiyerlee commented Nov 14, 2024

What changed

Endpoint /api/v1/can-funding-summary changes:

  • Add filter options (active_period, fy_budget, portfolio, transfer) and can ids to query parameters
  • Add support for many and all cans
  • Response includes new attributes: new_funding, in_draft_funding
  • Add helper functions to get can funding summaries in ops_api/ops/utils/cans.py
  • Add service for can funding summary

Front-end (FE) changes:

  • Update the opsAPI query and application context definition of the endpoint
  • Update FE unit tests accordingly
  • Update FE components with new response data structure
  • Update can summary cards to use api data

Issues

Update CAN Funding summary endpoint #2962
Add DRAFT budget lines to /can-funding-summary response #3070

How to test

Ensure all unit and E2E tests are passing.

Screenshots

N/A

Definition of Done Checklist

  • OESA: Code refactored for clarity
  • OESA: Dependency rules followed
  • Automated unit tests updated and passed
  • Automated integration tests updated and passed
  • Automated quality tests updated and passed
  • Automated load tests updated and passed
  • Automated a11y tests updated and passed
  • Automated security tests updated and passed
  • 90%+ Code coverage achieved
    - [ ] Form validations updated

Links

New Funding

@maiyerlee maiyerlee changed the title feat: add many cans and filter support to can budget summary endpoint 2962: CAN Summary Card - update funding summary endpoint Nov 18, 2024
@maiyerlee maiyerlee self-assigned this Nov 18, 2024
@maiyerlee maiyerlee force-pushed the OPS-2962-update-CAN-summary-endpoint branch from eaca2c4 to b7f1898 Compare November 19, 2024 19:00
@maiyerlee maiyerlee marked this pull request as ready for review November 20, 2024 07:10
@@ -172,7 +172,7 @@ def register_api(api_bp: Blueprint) -> None:
)

api_bp.add_url_rule(
"/can-funding-summary/<int:id>",
Copy link
Contributor

Choose a reason for hiding this comment

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

The endpoints for *ITEM_API_VIEW* are designed to take an resource id, e.g. <int:id> while the *LIST_API_VIEW does not. It would be more consistent if /can-funding-summary/ used CAN_FUNDING_RECEIVED_LIST_API_VIEW_FUNC.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great catch! I changed the view name to CAN_FUNDING_SUMMARY_LIST_API_VIEW_FUNC.


# Check if required 'can_ids' parameter is provided
if not can_ids:
return make_response_with_headers({"error": "'can_ids' parameter is required"}, 400)
Copy link
Contributor

Choose a reason for hiding this comment

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

The above request.args handling and can_ids validation would be better in a Marshmallow schema but it would be acceptable to take that as a tech debt item if you don't have time to implement it.

@@ -87,15 +108,109 @@ def get_can_funding_summary(can: CAN, fiscal_year: Optional[int] = None) -> CanF
available_funding = total_funding - sum([planned_funding, obligated_funding, in_execution_funding]) or 0

return {
"can": can.to_dict(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be better as a Marshmallow schema for the response but OK as tech debt.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the items below to avoid tech debt:

  • request and response Marshmallow schemas
  • new service for can funding summary

Copy link
Contributor

@fpigeonjr fpigeonjr left a comment

Choose a reason for hiding this comment

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

🐝 swarming on this past few days and it's working great

inExecutionFunding={fundingSummaryData?.in_execution_funding}
/>}
/>
<DebugCode
Copy link
Contributor

Choose a reason for hiding this comment

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

👀 let's remove this before merging in

fpigeonjr and others added 3 commits November 25, 2024 10:13
@jonnalley jonnalley requested a review from johndeange November 27, 2024 21:37
@maiyerlee maiyerlee merged commit 68f5ecd into main Dec 2, 2024
42 checks passed
@maiyerlee maiyerlee deleted the OPS-2962-update-CAN-summary-endpoint branch December 2, 2024 17:49
Copy link

github-actions bot commented Dec 2, 2024

🎉 This PR is included in version 1.8.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants