Skip to content

Commit

Permalink
Add fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
digitaldrk committed Jan 14, 2025
1 parent c7b757e commit fd5f859
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def initialize(form)
@income_data = DebtsApi::V0::FsrFormTransform::IncomeCalculator.new(form).get_monthly_income
@asset_data = DebtsApi::V0::FsrFormTransform::AssetCalculator.new(form).transform_assets
@enhanced_expense_calculator =
DebtsApi::V0::FsrFormTransform::EnhancedExpenseCalculator.new(form).transform_expenses
DebtsApi::V0::FsrFormTransform::EnhancedExpenseCalculator.new(deep_transform_keys_to_camel_case(form)).transform_expenses

Check failure on line 20 in modules/debts_api/lib/debts_api/v0/fsr_form_transform/streamlined_calculator.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Layout/LineLength: Line is too long. [133/120]
end

def get_streamlined_data
Expand Down Expand Up @@ -74,10 +74,7 @@ def streamlined_short_form?
def streamlined_long_form?
return false unless eligible_for_streamlined? && are_liquid_assets_below_gmt_threshold?

meets_streamlined_long_form_common_conditions =
!income_below_gmt_threshold? && income_below_upper_threshold? && income_below_discretionary_threshold?

meets_streamlined_long_form_common_conditions || streamlined_waiver_asset_update?
!income_below_gmt_threshold? && income_below_upper_threshold? && income_below_discretionary_threshold?
end

def eligible_for_streamlined?
Expand Down Expand Up @@ -129,6 +126,18 @@ def debt_below_vha_limit?
def streamlined?
streamlined_short_form? || streamlined_long_form?
end

def deep_transform_keys_to_camel_case(value)
case value
when Hash
value.deep_transform_keys { |key| key.to_s.underscore.camelize(:lower) }
.transform_values { |v| deep_transform_keys_to_camel_case(v) }
when Array
value.map { |v| deep_transform_keys_to_camel_case(v) }
else
value
end
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,19 @@
"income_below_gmt": false,
"income_below_one_fifty_gmt": true,
"liquid_assets_below_gmt": true
}
},
"utility_records": [
{
"name": "Electricity",
"amount": "402.35"
},
{
"name": "Gas",
"amount": "300.00"
},
{
"name": "Cable",
"amount": "390.47"
}
]
}

0 comments on commit fd5f859

Please sign in to comment.