fix the home page
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
def estimated_aid(total_balance, household_size, household_income):
|
||||
"""Estimate aid using a Massachusetts cost-adjusted poverty benchmark."""
|
||||
|
||||
if household_size < 1:
|
||||
raise ValueError("household_size must be at least 1")
|
||||
if total_balance < 0 or household_income < 0:
|
||||
raise ValueError("balance and income cannot be negative")
|
||||
|
||||
# Official 2026 federal poverty guideline for the contiguous states.
|
||||
federal_poverty_level = (
|
||||
15_960 + 5_680 * (household_size - 1)
|
||||
)
|
||||
|
||||
# Massachusetts prices are approximately 5.757% above the
|
||||
# national average according to the latest available BEA data.
|
||||
massachusetts_cost_factor = 1.05757
|
||||
|
||||
# This is an internal cost-adjusted benchmark, not the official FPL.
|
||||
adjusted_need_threshold = (
|
||||
federal_poverty_level * massachusetts_cost_factor
|
||||
)
|
||||
|
||||
# Protect household income up to 200% of the adjusted benchmark.
|
||||
protected_income = 2.0 * adjusted_need_threshold
|
||||
|
||||
# Only income exceeding the protected amount is considered available.
|
||||
discretionary_income = max(
|
||||
0.0,
|
||||
household_income - protected_income,
|
||||
)
|
||||
|
||||
# Expect 10% of discretionary income to be available for school fees.
|
||||
expected_contribution = 0.10 * discretionary_income
|
||||
|
||||
# Aid covers the remaining fee balance.
|
||||
estimated = total_balance - expected_contribution
|
||||
|
||||
# Prevent negative awards or awards exceeding the fee balance.
|
||||
return round(
|
||||
max(0.0, min(total_balance, estimated)),
|
||||
2,
|
||||
)
|
||||
|
||||
|
||||
def final_rebate(
|
||||
total_balance,
|
||||
household_size,
|
||||
household_income,
|
||||
amount_requested,
|
||||
):
|
||||
"""Return estimated aid capped by the request and fee balance."""
|
||||
|
||||
if amount_requested < 0:
|
||||
raise ValueError("amount_requested cannot be negative")
|
||||
|
||||
estimated = estimated_aid(
|
||||
total_balance,
|
||||
household_size,
|
||||
household_income,
|
||||
)
|
||||
|
||||
return min(estimated, amount_requested, total_balance)
|
||||
Reference in New Issue
Block a user