Skip to content

Commit

Permalink
Merge pull request #2993 from fedspendingtransparency/fix/dev-6907-epic
Browse files Browse the repository at this point in the history
[DEV-6907] multi-year calculations epic hotfixes
  • Loading branch information
tony-sappe authored Feb 25, 2021
2 parents 7d209cb + 2fb598c commit 5438e75
Show file tree
Hide file tree
Showing 17 changed files with 487 additions and 286 deletions.
2 changes: 1 addition & 1 deletion usaspending_api/common/etl/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from usaspending_api.common.etl import ETLObjectBase
from usaspending_api.common.etl.operations import delete_obsolete_rows, insert_missing_rows, update_changed_rows
from usaspending_api.common.helpers.sql_helpers import execute_dml_sql
from usaspending_api.common.helpers.timing_helpers import ConsoleTimer as Timer
from usaspending_api.common.helpers.timing_helpers import ScriptTimer as Timer


class ETLMixin:
Expand Down
2 changes: 0 additions & 2 deletions usaspending_api/disaster/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
multi_period_faba,
multi_period_faba_with_future,
multi_year_faba,
non_covid_gtas,
other_budget_authority_gtas,
partially_completed_year,
quarterly_gtas,
Expand Down Expand Up @@ -121,7 +120,6 @@
"multi_period_faba",
"multi_period_faba_with_future",
"multi_year_faba",
"non_covid_gtas",
"other_budget_authority_gtas",
"partially_completed_year",
"quarterly_gtas",
Expand Down
85 changes: 61 additions & 24 deletions usaspending_api/disaster/tests/fixtures/disaster_account_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,11 @@ def disaster_account_data():
program_activity=pa1,
object_class=oc1,
disaster_emergency_fund=defc_l,
obligations_incurred_by_program_object_class_cpe=1,
gross_outlay_amount_by_program_object_class_cpe=10000000,
obligations_incurred_by_program_object_class_cpe=10,
gross_outlay_amount_by_program_object_class_cpe=9850000,
deobligations_recoveries_refund_pri_program_object_class_cpe=-9,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=50000,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=100000,
)
mommy.make(
fabpaoc,
Expand All @@ -303,8 +306,11 @@ def disaster_account_data():
program_activity=pa2,
object_class=oc2,
disaster_emergency_fund=defc_m,
obligations_incurred_by_program_object_class_cpe=10,
gross_outlay_amount_by_program_object_class_cpe=1000000,
obligations_incurred_by_program_object_class_cpe=100,
gross_outlay_amount_by_program_object_class_cpe=985000,
deobligations_recoveries_refund_pri_program_object_class_cpe=-90,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=5000,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=10000,
)
mommy.make(
fabpaoc,
Expand All @@ -314,8 +320,11 @@ def disaster_account_data():
program_activity=pa3,
object_class=oc3,
disaster_emergency_fund=defc_p,
obligations_incurred_by_program_object_class_cpe=100,
gross_outlay_amount_by_program_object_class_cpe=100000,
obligations_incurred_by_program_object_class_cpe=1000,
gross_outlay_amount_by_program_object_class_cpe=98500,
deobligations_recoveries_refund_pri_program_object_class_cpe=-900,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=500,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=1000,
)
mommy.make(
fabpaoc,
Expand All @@ -325,8 +334,11 @@ def disaster_account_data():
program_activity=pa4,
object_class=oc4,
disaster_emergency_fund=defc_o,
obligations_incurred_by_program_object_class_cpe=1000,
gross_outlay_amount_by_program_object_class_cpe=10000,
obligations_incurred_by_program_object_class_cpe=10000,
gross_outlay_amount_by_program_object_class_cpe=9850,
deobligations_recoveries_refund_pri_program_object_class_cpe=-9000,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=50,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=100,
)
mommy.make(
fabpaoc,
Expand All @@ -336,8 +348,11 @@ def disaster_account_data():
program_activity=pa4,
object_class=oc3,
disaster_emergency_fund=defc_n,
obligations_incurred_by_program_object_class_cpe=10000,
gross_outlay_amount_by_program_object_class_cpe=1000,
obligations_incurred_by_program_object_class_cpe=100000,
gross_outlay_amount_by_program_object_class_cpe=985,
deobligations_recoveries_refund_pri_program_object_class_cpe=-90000,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=5,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=10,
)
mommy.make(
fabpaoc,
Expand All @@ -347,8 +362,11 @@ def disaster_account_data():
program_activity=pa4,
object_class=oc6,
disaster_emergency_fund=defc_n,
obligations_incurred_by_program_object_class_cpe=100000,
gross_outlay_amount_by_program_object_class_cpe=100,
obligations_incurred_by_program_object_class_cpe=1000000,
gross_outlay_amount_by_program_object_class_cpe=98.5,
deobligations_recoveries_refund_pri_program_object_class_cpe=-900000,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=0.5,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=1,
)
mommy.make(
fabpaoc,
Expand All @@ -358,8 +376,11 @@ def disaster_account_data():
program_activity=pa4,
object_class=oc4,
disaster_emergency_fund=defc_o,
obligations_incurred_by_program_object_class_cpe=1000000,
gross_outlay_amount_by_program_object_class_cpe=10,
obligations_incurred_by_program_object_class_cpe=10000000,
gross_outlay_amount_by_program_object_class_cpe=8.5,
deobligations_recoveries_refund_pri_program_object_class_cpe=-9000000,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=0.5,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=1,
)
mommy.make(
fabpaoc,
Expand All @@ -369,8 +390,11 @@ def disaster_account_data():
program_activity=pa4,
object_class=oc4,
disaster_emergency_fund=defc_o,
obligations_incurred_by_program_object_class_cpe=10000000,
gross_outlay_amount_by_program_object_class_cpe=1,
obligations_incurred_by_program_object_class_cpe=100000000,
gross_outlay_amount_by_program_object_class_cpe=0.85,
deobligations_recoveries_refund_pri_program_object_class_cpe=-90000000,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=0.05,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=0.1,
)
mommy.make(
fabpaoc,
Expand All @@ -380,26 +404,35 @@ def disaster_account_data():
program_activity=pa5,
object_class=oc5,
disaster_emergency_fund=defc_p,
obligations_incurred_by_program_object_class_cpe=0,
gross_outlay_amount_by_program_object_class_cpe=0,
obligations_incurred_by_program_object_class_cpe=100,
gross_outlay_amount_by_program_object_class_cpe=100,
deobligations_recoveries_refund_pri_program_object_class_cpe=-100,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=-50,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=-50,
)
mommy.make(
fabpaoc,
final_of_fy=True,
treasury_account=tas5,
submission=sub1,
disaster_emergency_fund=None,
obligations_incurred_by_program_object_class_cpe=10,
gross_outlay_amount_by_program_object_class_cpe=1000000,
obligations_incurred_by_program_object_class_cpe=5,
gross_outlay_amount_by_program_object_class_cpe=60000,
deobligations_recoveries_refund_pri_program_object_class_cpe=-5,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=930000,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=1000,
)
mommy.make(
fabpaoc,
final_of_fy=True,
treasury_account=tas6,
submission=sub1,
disaster_emergency_fund=None,
obligations_incurred_by_program_object_class_cpe=100,
gross_outlay_amount_by_program_object_class_cpe=100000,
obligations_incurred_by_program_object_class_cpe=125,
gross_outlay_amount_by_program_object_class_cpe=50000,
deobligations_recoveries_refund_pri_program_object_class_cpe=-25,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=25000,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=25000,
)

a1 = mommy.make(
Expand Down Expand Up @@ -580,8 +613,10 @@ def disaster_account_data():
tas_rendering_label="003-X-0000-000",
treasury_account_identifier=tas3,
budget_authority_appropriation_amount_cpe=2398472389.78,
total_budgetary_resources_cpe=23984723890.78,
total_budgetary_resources_cpe=23986200349.56,
budget_authority_unobligated_balance_brought_forward_cpe=1000,
deobligations_or_recoveries_or_refunds_from_prior_year_cpe=1238972.78,
prior_year_paid_obligation_recoveries=237486,
fiscal_period=12,
fiscal_year=2021,
)
Expand All @@ -591,8 +626,10 @@ def disaster_account_data():
tas_rendering_label="002-X-0000-000",
treasury_account_identifier=tas2,
budget_authority_appropriation_amount_cpe=892743123.12,
total_budgetary_resources_cpe=8927431230.12,
total_budgetary_resources_cpe=8927768300.12,
budget_authority_unobligated_balance_brought_forward_cpe=2000,
deobligations_or_recoveries_or_refunds_from_prior_year_cpe=238746,
prior_year_paid_obligation_recoveries=98324,
fiscal_period=8,
fiscal_year=2022,
)
47 changes: 34 additions & 13 deletions usaspending_api/disaster/tests/fixtures/federal_account_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,44 +95,59 @@ def generic_account_data():
"financial_activities.FinancialAccountsByProgramActivityObjectClass",
submission=sub1,
final_of_fy=True,
obligations_incurred_by_program_object_class_cpe=100,
gross_outlay_amount_by_program_object_class_cpe=111,
obligations_incurred_by_program_object_class_cpe=1000,
gross_outlay_amount_by_program_object_class_cpe=100,
deobligations_recoveries_refund_pri_program_object_class_cpe=-900,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=10,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=1,
disaster_emergency_fund=defc_m,
treasury_account=tre_acct1,
)
mommy.make(
"financial_activities.FinancialAccountsByProgramActivityObjectClass",
submission=sub1,
final_of_fy=True,
obligations_incurred_by_program_object_class_cpe=200,
gross_outlay_amount_by_program_object_class_cpe=222,
obligations_incurred_by_program_object_class_cpe=500,
gross_outlay_amount_by_program_object_class_cpe=20,
deobligations_recoveries_refund_pri_program_object_class_cpe=-300,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=2,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=200,
disaster_emergency_fund=defc_l,
treasury_account=tre_acct2,
)
mommy.make(
"financial_activities.FinancialAccountsByProgramActivityObjectClass",
submission=sub1,
final_of_fy=True,
obligations_incurred_by_program_object_class_cpe=2,
gross_outlay_amount_by_program_object_class_cpe=2,
obligations_incurred_by_program_object_class_cpe=6,
gross_outlay_amount_by_program_object_class_cpe=7,
deobligations_recoveries_refund_pri_program_object_class_cpe=-4,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=-2,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=-3,
disaster_emergency_fund=defc_9,
treasury_account=tre_acct2,
)
mommy.make(
"financial_activities.FinancialAccountsByProgramActivityObjectClass",
submission=sub1,
final_of_fy=True,
obligations_incurred_by_program_object_class_cpe=1,
gross_outlay_amount_by_program_object_class_cpe=1,
obligations_incurred_by_program_object_class_cpe=10,
gross_outlay_amount_by_program_object_class_cpe=4,
deobligations_recoveries_refund_pri_program_object_class_cpe=-9,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=-1,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=-2,
disaster_emergency_fund=defc_o,
treasury_account=tre_acct2,
)
mommy.make(
"financial_activities.FinancialAccountsByProgramActivityObjectClass",
submission=sub1,
final_of_fy=True,
obligations_incurred_by_program_object_class_cpe=3,
gross_outlay_amount_by_program_object_class_cpe=333,
obligations_incurred_by_program_object_class_cpe=13,
gross_outlay_amount_by_program_object_class_cpe=296,
deobligations_recoveries_refund_pri_program_object_class_cpe=-10,
ussgl487200_down_adj_pri_ppaid_undel_orders_oblig_refund_cpe=30,
ussgl497200_down_adj_pri_paid_deliv_orders_oblig_refund_cpe=7,
disaster_emergency_fund=defc_n,
treasury_account=tre_acct3,
)
Expand Down Expand Up @@ -205,7 +220,9 @@ def generic_account_data():
fiscal_period=12,
disaster_emergency_fund_code="M",
treasury_account_identifier=tre_acct1,
total_budgetary_resources_cpe=43580.0,
total_budgetary_resources_cpe=1125181,
deobligations_or_recoveries_or_refunds_from_prior_year_cpe=983274,
prior_year_paid_obligation_recoveries=98327,
)
mommy.make(
"references.GTASSF133Balances",
Expand All @@ -215,7 +232,9 @@ def generic_account_data():
fiscal_period=12,
disaster_emergency_fund_code="M",
treasury_account_identifier=tre_acct2,
total_budgetary_resources_cpe=1092370.0,
total_budgetary_resources_cpe=36475837.1,
deobligations_or_recoveries_or_refunds_from_prior_year_cpe=32984723.9,
prior_year_paid_obligation_recoveries=2398743.2,
)
mommy.make(
"references.GTASSF133Balances",
Expand All @@ -225,7 +244,9 @@ def generic_account_data():
fiscal_period=7,
disaster_emergency_fund_code="M",
treasury_account_identifier=tre_acct3,
total_budgetary_resources_cpe=392480.0,
total_budgetary_resources_cpe=394368.87,
deobligations_or_recoveries_or_refunds_from_prior_year_cpe=999.99,
prior_year_paid_obligation_recoveries=888.88,
)


Expand Down
Loading

0 comments on commit 5438e75

Please sign in to comment.