Skip to content

Commit

Permalink
Merge pull request #3303 from HHS/ops-3297-update-method-of-transfer
Browse files Browse the repository at this point in the history
feat: adds new Other CAN Method of Transfer
  • Loading branch information
jonnalley authored Jan 15, 2025
2 parents 26228fe + ef04f11 commit 3bdb8e0
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""adding new CAN Method of Transfer
Revision ID: 52bf070f396e
Revises: 6615ac7d4eea
Create Date: 2025-01-14 06:16:14.707739+00:00
"""
from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op
from alembic_postgresql_enum import TableReference

# revision identifiers, used by Alembic.
revision: str = '52bf070f396e'
down_revision: Union[str, None] = '6615ac7d4eea'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.sync_enum_values(
enum_schema='ops',
enum_name='canmethodoftransfer',
new_values=['DIRECT', 'COST_SHARE', 'IAA', 'IDDA', 'OTHER'],
affected_columns=[TableReference(table_schema='ops', table_name='can_funding_details', column_name='method_of_transfer'), TableReference(table_schema='ops', table_name='can_funding_details_version', column_name='method_of_transfer')],
enum_values_to_rename=[],
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.sync_enum_values(
enum_schema='ops',
enum_name='canmethodoftransfer',
new_values=['DIRECT', 'COST_SHARE', 'IAA', 'IDDA'],
affected_columns=[TableReference(table_schema='ops', table_name='can_funding_details', column_name='method_of_transfer'), TableReference(table_schema='ops', table_name='can_funding_details_version', column_name='method_of_transfer')],
enum_values_to_rename=[],
)
# ### end Alembic commands ###
1 change: 1 addition & 0 deletions backend/models/cans.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class CANMethodOfTransfer(Enum):
COST_SHARE = auto()
IAA = auto()
IDDA = auto()
OTHER = auto()


class CANStatus(Enum):
Expand Down
3 changes: 3 additions & 0 deletions backend/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,7 @@ paths:
- COST_SHARE
- IAA
- IDDA
- OTHER
example: [ "DIRECT", "IAA" ]
- name: portfolio
in: query
Expand Down Expand Up @@ -2967,6 +2968,7 @@ components:
- COST_SHARE
- IAA
- IDDA
- OTHER
sub_allowance:
type: string
FundingDetails:
Expand Down Expand Up @@ -3002,6 +3004,7 @@ components:
- COST_SHARE
- IAA
- IDDA
- OTHER
sub_allowance:
type: string
created_on:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_can_get_can_funding_summary_invalid_transfer(auth_client: FlaskClient):
query_params = f"can_ids={0}&fiscal_year=2023&transfer=INVALID"
response = auth_client.get(f"/api/v1/can-funding-summary?{query_params}")
assert response.status_code == 400
assert response.json["Error"] == "Invalid 'transfer' value. Must be one of: DIRECT, COST_SHARE, IAA, IDDA."
assert response.json["Error"] == "Invalid 'transfer' value. Must be one of: DIRECT, COST_SHARE, IAA, IDDA, OTHER."


def test_can_get_can_funding_summary_mou_transfer(auth_client: FlaskClient):
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/CANs/CAN.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export const CAN_TRANSFER = {
DIRECT: "Direct",
COST_SHARE: "COST_SHARE",
IDDA: "IDDA",
IAA: "IAA"
IAA: "IAA",
OTHER: "OTHER"
};
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const CANTransferComboBox = ({
{ id: 1, title: convertCodeForDisplay("methodOfTransfer", CAN_TRANSFER.DIRECT) },
{ id: 2, title: convertCodeForDisplay("methodOfTransfer", CAN_TRANSFER.COST_SHARE) },
{ id: 3, title: convertCodeForDisplay("methodOfTransfer", CAN_TRANSFER.IAA) },
{ id: 4, title: convertCodeForDisplay("methodOfTransfer", CAN_TRANSFER.IDDA) }
{ id: 4, title: convertCodeForDisplay("methodOfTransfer", CAN_TRANSFER.IDDA) },
{ id: 5, title: convertCodeForDisplay("methodOfTransfer", CAN_TRANSFER.OTHER) }
];

return (
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,10 @@ export const codesToDisplayText = {
},
methodOfTransfer: {
DIRECT: "Direct",
COST_SHARE: "MOU",
COST_SHARE: "Cost Share",
IAA: "IAA",
IDDA: "IDDA"
IDDA: "IDDA",
OTHER: "Other"
},
project: {
ADMINISTRATIVE_AND_SUPPORT: "Admin & Support",
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/pages/cans/list/CanList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ const CanList = () => {

const activePeriodIds = filters.activePeriod.map((ap) => ap.id);
const transferTitles = filters.transfer.map((t) => {
const title = t.title.toUpperCase();
return title === "MOU" ? "COST_SHARE" : title;
return t.title.toUpperCase();
});
const portfolioAbbreviations = filters.portfolio.map((p) => p.abbr);

Expand Down

0 comments on commit 3bdb8e0

Please sign in to comment.