Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
annvelents committed Sep 26, 2024
1 parent 2e46bd5 commit 0bf0062
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def calculated_amount_details
charges_details_without_last_event = applied_charge_model_excluding_event.amount_details
return {} if all_charges_details.blank? || charges_details_without_last_event.blank?

fixed_values = { rate: all_charges_details[:rate], fixed_fee_unit_amount: all_charges_details[:fixed_fee_unit_amount] }
fixed_values = {rate: all_charges_details[:rate], fixed_fee_unit_amount: all_charges_details[:fixed_fee_unit_amount]}
details = CHARGE_AMOUNT_DETAILS_KEYS.each_with_object(fixed_values) do |key, result|
result[key] = (all_charges_details[key].to_f - charges_details_without_last_event[key].to_f).to_s
end
Expand Down
6 changes: 3 additions & 3 deletions spec/models/charge_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -527,15 +527,15 @@

describe '#simple_percentage?' do
it 'returns false if charge model is not percentage' do
expect(build(:standard_charge).simple_percentage?).to be_falsey
expect(build(:standard_charge)).not_to be_simple_percentage
end

it 'returns false if charge model is percentage but has other properties except rate' do
expect(build(:charge, charge_model: 'percentage', properties: {fixed_amount: '20'}).simple_percentage?).to be_falsey
expect(build(:charge, charge_model: 'percentage', properties: {fixed_amount: '20'})).not_to be_simple_percentage
end

it 'returns true only if properties of percentage charge contain only rate' do
expect(build(:charge, charge_model: 'percentage', properties: {rate: '0.20'}).simple_percentage?).to be_truthy
expect(build(:charge, charge_model: 'percentage', properties: {rate: '0.20'})).to be_simple_percentage
end
end
end
58 changes: 29 additions & 29 deletions spec/scenarios/pay_in_advance_charges_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -772,10 +772,10 @@
events_count: 1,
amount_cents: 0,
amount_details: {
"rate"=>"5.0", "units"=>"8.0", "free_units"=>"8.0", "paid_units"=>"0.0",
"free_events"=>"1.0", "paid_events"=>"0.0", "fixed_fee_unit_amount"=>"0.0",
"per_unit_total_amount"=>"0.0", "fixed_fee_total_amount"=>"0.0",
"min_max_adjustment_total_amount"=>"0.0"
"rate" => "5.0", "units" => "8.0", "free_units" => "8.0", "paid_units" => "0.0",
"free_events" => "1.0", "paid_events" => "0.0", "fixed_fee_unit_amount" => "0.0",
"per_unit_total_amount" => "0.0", "fixed_fee_total_amount" => "0.0",
"min_max_adjustment_total_amount" => "0.0"
}
)
end
Expand Down Expand Up @@ -805,10 +805,10 @@
events_count: 1,
amount_cents: 0,
amount_details: {
"rate"=>"5.0", "units"=>"5.0", "free_units"=>"5.0", "paid_units"=>"0.0",
"free_events"=>"1.0", "paid_events"=>"0.0", "fixed_fee_unit_amount"=>"0.0",
"per_unit_total_amount"=>"0.0", "fixed_fee_total_amount"=>"0.0",
"min_max_adjustment_total_amount"=>"0.0"
"rate" => "5.0", "units" => "5.0", "free_units" => "5.0", "paid_units" => "0.0",
"free_events" => "1.0", "paid_events" => "0.0", "fixed_fee_unit_amount" => "0.0",
"per_unit_total_amount" => "0.0", "fixed_fee_total_amount" => "0.0",
"min_max_adjustment_total_amount" => "0.0"
}
)
end
Expand All @@ -833,10 +833,10 @@
events_count: 1,
amount_cents: 100 + 15,
amount_details: {
"rate"=>"5.0", "units"=>"3.0", "free_units"=>"0.0", "paid_units"=>"3.0",
"free_events"=>"0.0", "paid_events"=>"1.0", "fixed_fee_unit_amount"=>"1.0",
"per_unit_total_amount"=>"0.15", "fixed_fee_total_amount"=>"1.0",
"min_max_adjustment_total_amount"=>"0.0"
"rate" => "5.0", "units" => "3.0", "free_units" => "0.0", "paid_units" => "3.0",
"free_events" => "0.0", "paid_events" => "1.0", "fixed_fee_unit_amount" => "1.0",
"per_unit_total_amount" => "0.15", "fixed_fee_total_amount" => "1.0",
"min_max_adjustment_total_amount" => "0.0"
}
)
end
Expand Down Expand Up @@ -893,10 +893,10 @@
events_count: 1,
amount_cents: 0,
amount_details: {
"rate"=>"5.0", "units"=>"100.0", "free_units"=>"100.0", "paid_units"=>"0.0",
"free_events"=>"1.0", "paid_events"=>"0.0", "fixed_fee_unit_amount"=>"0.0",
"per_unit_total_amount"=>"0.0", "fixed_fee_total_amount"=>"0.0",
"min_max_adjustment_total_amount"=>"0.0"
"rate" => "5.0", "units" => "100.0", "free_units" => "100.0", "paid_units" => "0.0",
"free_events" => "1.0", "paid_events" => "0.0", "fixed_fee_unit_amount" => "0.0",
"per_unit_total_amount" => "0.0", "fixed_fee_total_amount" => "0.0",
"min_max_adjustment_total_amount" => "0.0"
}
)
end
Expand Down Expand Up @@ -926,10 +926,10 @@
events_count: 1,
amount_cents: 0,
amount_details: {
"rate"=>"5.0", "units"=>"10.0", "free_units"=>"10.0", "paid_units"=>"0.0",
"free_events"=>"1.0", "paid_events"=>"0.0", "fixed_fee_unit_amount"=>"0.0",
"per_unit_total_amount"=>"0.0", "fixed_fee_total_amount"=>"0.0",
"min_max_adjustment_total_amount"=>"0.0"
"rate" => "5.0", "units" => "10.0", "free_units" => "10.0", "paid_units" => "0.0",
"free_events" => "1.0", "paid_events" => "0.0", "fixed_fee_unit_amount" => "0.0",
"per_unit_total_amount" => "0.0", "fixed_fee_total_amount" => "0.0",
"min_max_adjustment_total_amount" => "0.0"
}
)
end
Expand Down Expand Up @@ -959,10 +959,10 @@
events_count: 1,
amount_cents: 150,
amount_details: {
"rate"=>"5.0", "units"=>"20.0", "free_units"=>"10.0", "paid_units"=>"10.0",
"free_events"=>"0.0", "paid_events"=>"1.0", "fixed_fee_unit_amount"=>"1.0",
"per_unit_total_amount"=>"0.5", "fixed_fee_total_amount"=>"1.0",
"min_max_adjustment_total_amount"=>"0.0"
"rate" => "5.0", "units" => "20.0", "free_units" => "10.0", "paid_units" => "10.0",
"free_events" => "0.0", "paid_events" => "1.0", "fixed_fee_unit_amount" => "1.0",
"per_unit_total_amount" => "0.5", "fixed_fee_total_amount" => "1.0",
"min_max_adjustment_total_amount" => "0.0"
}
)
end
Expand Down Expand Up @@ -992,12 +992,12 @@
events_count: 1,
amount_cents: 200,
amount_details: {
"rate"=>"5.0", "units"=>"20.0", "free_units"=>"0.0", "paid_units"=>"20.0",
"free_events"=>"0.0", "paid_events"=>"1.0", "fixed_fee_unit_amount"=>"1.0",
"per_unit_total_amount"=>"1.0", "fixed_fee_total_amount"=>"1.0",
"min_max_adjustment_total_amount"=>"0.0"
"rate" => "5.0", "units" => "20.0", "free_units" => "0.0", "paid_units" => "20.0",
"free_events" => "0.0", "paid_events" => "1.0", "fixed_fee_unit_amount" => "1.0",
"per_unit_total_amount" => "1.0", "fixed_fee_total_amount" => "1.0",
"min_max_adjustment_total_amount" => "0.0"
}
)
)
end
end
end
Expand Down

0 comments on commit 0bf0062

Please sign in to comment.