Skip to content

Commit

Permalink
Added exception from exempt to helper
Browse files Browse the repository at this point in the history
  • Loading branch information
martent committed Apr 30, 2019
1 parent a072d22 commit 74987ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions app/lib/economy/rates_for_refugee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ module Economy
class RatesForRefugee < Base
RATE_CATEGORIES_AND_RATES = RateCategory.includes(:rates).all

attr_reader :replace_rates

def initialize(refugee, interval = DEFAULT_INTERVAL)
@refugee = refugee
@interval = interval
Expand Down
11 changes: 5 additions & 6 deletions app/reports/helpers/economy_uppbokning_report_helper.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
module EconomyUppbokningReportHelper
def expected_income(record)
replace_rates = Economy::RatesForRefugee.new(
record[:refugee], from: record[:from], to: record[:to]
).replace_rates

sum_formula(
record[:rates]&.map { |x| "#{x[:days]}*#{x[:amount]}" }&.compact&.join('+'),
# Special case, see class doc
::Economy::ReplaceRatesWithActualCosts.new(
record[:refugee],
from: record[:from],
to: record[:to]
).as_formula
replace_rates.as_formula
)
end
end

0 comments on commit 74987ee

Please sign in to comment.