foodsoft/app/models/concerns/price_calculation.rb
Philipp Rothmann fb2b4d8a8a chore: rubocop
chore: fix api test conventions

chore: rubocop -A spec/

chore: more rubocop -A

fix failing test

rubocop fixes

removes helper methods that are in my opinion dead code

more rubocop fixes

rubocop -a --auto-gen-config
2023-06-09 17:35:05 +02:00

20 lines
434 B
Ruby

module PriceCalculation
extend ActiveSupport::Concern
# Gross price = net price + deposit + tax.
# @return [Number] Gross price.
def gross_price
add_percent(price + deposit, tax)
end
# @return [Number] Price for the foodcoop-member.
def fc_price
add_percent(gross_price, FoodsoftConfig[:price_markup])
end
private
def add_percent(value, percent)
(value * ((percent * 0.01) + 1)).round(2)
end
end