Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

round down member premiums individually and sum up the premiums #163

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ gem 'pg'
gem 'puma', '~> 6.4.3'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 7.0.8.5'
gem 'rails', '~> 7.0.8.7'

gem 'rbnacl'

Expand Down
138 changes: 69 additions & 69 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -80,67 +80,67 @@ GEM
remote: https://rubygems.org/
specs:
abbrev (0.1.2)
actioncable (7.0.8.5)
actionpack (= 7.0.8.5)
activesupport (= 7.0.8.5)
actioncable (7.0.8.7)
actionpack (= 7.0.8.7)
activesupport (= 7.0.8.7)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.8.5)
actionpack (= 7.0.8.5)
activejob (= 7.0.8.5)
activerecord (= 7.0.8.5)
activestorage (= 7.0.8.5)
activesupport (= 7.0.8.5)
actionmailbox (7.0.8.7)
actionpack (= 7.0.8.7)
activejob (= 7.0.8.7)
activerecord (= 7.0.8.7)
activestorage (= 7.0.8.7)
activesupport (= 7.0.8.7)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.8.5)
actionpack (= 7.0.8.5)
actionview (= 7.0.8.5)
activejob (= 7.0.8.5)
activesupport (= 7.0.8.5)
actionmailer (7.0.8.7)
actionpack (= 7.0.8.7)
actionview (= 7.0.8.7)
activejob (= 7.0.8.7)
activesupport (= 7.0.8.7)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.8.5)
actionview (= 7.0.8.5)
activesupport (= 7.0.8.5)
actionpack (7.0.8.7)
actionview (= 7.0.8.7)
activesupport (= 7.0.8.7)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.8.5)
actionpack (= 7.0.8.5)
activerecord (= 7.0.8.5)
activestorage (= 7.0.8.5)
activesupport (= 7.0.8.5)
actiontext (7.0.8.7)
actionpack (= 7.0.8.7)
activerecord (= 7.0.8.7)
activestorage (= 7.0.8.7)
activesupport (= 7.0.8.7)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.8.5)
activesupport (= 7.0.8.5)
actionview (7.0.8.7)
activesupport (= 7.0.8.7)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.8.5)
activesupport (= 7.0.8.5)
activejob (7.0.8.7)
activesupport (= 7.0.8.7)
globalid (>= 0.3.6)
activemodel (7.0.8.5)
activesupport (= 7.0.8.5)
activerecord (7.0.8.5)
activemodel (= 7.0.8.5)
activesupport (= 7.0.8.5)
activestorage (7.0.8.5)
actionpack (= 7.0.8.5)
activejob (= 7.0.8.5)
activerecord (= 7.0.8.5)
activesupport (= 7.0.8.5)
activemodel (7.0.8.7)
activesupport (= 7.0.8.7)
activerecord (7.0.8.7)
activemodel (= 7.0.8.7)
activesupport (= 7.0.8.7)
activestorage (7.0.8.7)
actionpack (= 7.0.8.7)
activejob (= 7.0.8.7)
activerecord (= 7.0.8.7)
activesupport (= 7.0.8.7)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.8.5)
activesupport (7.0.8.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -156,7 +156,7 @@ GEM
bootsnap (1.18.3)
msgpack (~> 1.2)
bson (4.15.0)
builder (3.2.4)
builder (3.3.0)
bunny (2.22.0)
amq-protocol (~> 2.3, >= 2.3.1)
sorted_set (~> 1, >= 1.0.2)
Expand All @@ -183,7 +183,7 @@ GEM
mongoid (>= 3.0, < 9.0)
mongoid-grid_fs (>= 1.3, < 3.0)
coderay (1.1.3)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.4)
crass (1.0.6)
database_cleaner-active_record (2.1.0)
activerecord (>= 5.a)
Expand All @@ -192,7 +192,7 @@ GEM
database_cleaner-mongoid (2.0.1)
database_cleaner-core (~> 2.0.0)
mongoid
date (3.3.4)
date (3.4.1)
datev (0.11.0)
deep_merge (1.2.2)
diff-lcs (1.5.1)
Expand Down Expand Up @@ -251,7 +251,7 @@ GEM
dry-initializer (~> 3.0)
dry-schema (~> 1.11, >= 1.11.0)
zeitwerk (~> 2.6)
erubi (1.12.0)
erubi (1.13.0)
ethon (0.16.0)
ffi (>= 1.15.0)
factory_bot (6.4.6)
Expand Down Expand Up @@ -281,7 +281,7 @@ GEM
temple (>= 0.8.2)
thor
tilt
i18n (1.14.1)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
image_processing (1.12.2)
Expand All @@ -308,16 +308,16 @@ GEM
net-imap
net-pop
net-smtp
marcel (1.0.2)
marcel (1.0.4)
matrix (0.4.2)
method_source (1.0.0)
method_source (1.1.0)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0206)
mini_magick (4.12.0)
mini_mime (1.1.5)
mini_portile2 (2.8.8)
minitest (5.22.2)
minitest (5.25.4)
monetize (1.13.0)
money (~> 6.12)
money (6.16.0)
Expand Down Expand Up @@ -349,7 +349,7 @@ GEM
msgpack (1.7.2)
multi_json (1.15.0)
multipart-post (2.4.0)
net-imap (0.5.0)
net-imap (0.5.1)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -358,7 +358,7 @@ GEM
timeout
net-smtp (0.5.0)
net-protocol
nio4r (2.7.0)
nio4r (2.7.4)
nokogiri (1.16.8)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
Expand Down Expand Up @@ -389,39 +389,39 @@ GEM
puma (6.4.3)
nio4r (~> 2.0)
racc (1.8.1)
rack (2.2.8.1)
rack (2.2.10)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.8.5)
actioncable (= 7.0.8.5)
actionmailbox (= 7.0.8.5)
actionmailer (= 7.0.8.5)
actionpack (= 7.0.8.5)
actiontext (= 7.0.8.5)
actionview (= 7.0.8.5)
activejob (= 7.0.8.5)
activemodel (= 7.0.8.5)
activerecord (= 7.0.8.5)
activestorage (= 7.0.8.5)
activesupport (= 7.0.8.5)
rails (7.0.8.7)
actioncable (= 7.0.8.7)
actionmailbox (= 7.0.8.7)
actionmailer (= 7.0.8.7)
actionpack (= 7.0.8.7)
actiontext (= 7.0.8.7)
actionview (= 7.0.8.7)
activejob (= 7.0.8.7)
activemodel (= 7.0.8.7)
activerecord (= 7.0.8.7)
activestorage (= 7.0.8.7)
activesupport (= 7.0.8.7)
bundler (>= 1.15.0)
railties (= 7.0.8.5)
railties (= 7.0.8.7)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.1)
loofah (~> 2.21)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
railties (7.0.8.5)
actionpack (= 7.0.8.5)
activesupport (= 7.0.8.5)
railties (7.0.8.7)
actionpack (= 7.0.8.7)
activesupport (= 7.0.8.7)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.1.0)
rake (13.2.1)
rbnacl (7.1.1)
ffi
rbs (3.4.4)
Expand Down Expand Up @@ -505,9 +505,9 @@ GEM
rbs
syntax_tree (>= 2.0.1)
temple (0.10.3)
thor (1.3.1)
thor (1.3.2)
tilt (2.3.0)
timeout (0.4.1)
timeout (0.4.2)
turbo-rails (2.0.4)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
Expand Down Expand Up @@ -535,7 +535,7 @@ GEM
yard (0.9.36)
yard-mongoid (0.1.0)
yard (>= 0.8.4)
zeitwerk (2.6.13)
zeitwerk (2.7.1)

PLATFORMS
arm64-darwin-21
Expand Down Expand Up @@ -566,7 +566,7 @@ DEPENDENCIES
prettier
pry-byebug
puma (~> 6.4.3)
rails (~> 7.0.8.5)
rails (~> 7.0.8.7)
rails-html-sanitizer (~> 1.6.1)
rbnacl
redcarpet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,12 +472,8 @@ def calculate_ehb_premium_for(insurance_policy, tax_household, enrollments_for_m
member_start_on = [enrollment.start_on, calender_month_begin].max
member_end_on = [enrollment.end_on || end_of_year, calender_month_end].min
coverage_days = (member_start_on..member_end_on).count
premium_rate =
if enrolled_member.tobacco_use == 'Y'
premium_schedule.non_tobacco_use_premium
else
premium_schedule.premium_amount
end
member_ehb_premium = fetch_member_ehb_premium(enrolled_member, premium_schedule, insurance_policy)
premium_rate = round_down_float_two_decimals(member_ehb_premium)

if calender_month_days == coverage_days
premium_rate
Expand All @@ -486,8 +482,18 @@ def calculate_ehb_premium_for(insurance_policy, tax_household, enrollments_for_m
end
end
.round(2)
total_ehb_premium = round_down_float_two_decimals(premium_amount.to_f * insurance_policy.insurance_product.ehb)
format('%.2f', total_ehb_premium)

format('%.2f', premium_amount)
end

def fetch_member_ehb_premium(enrolled_member, premium_schedule, insurance_policy)
tobacco_premium = premium_schedule.non_tobacco_use_premium.to_f
non_tobacco_premium = premium_schedule.premium_amount.to_f
member_premium = enrolled_member.tobacco_use == 'Y' ? tobacco_premium : non_tobacco_premium
return member_premium if member_premium.to_d == 0.00.to_d

result = member_premium * insurance_policy.insurance_product.ehb
member_premium - result >= 1 ? result : (member_premium - 1)
end

def get_enrolled_members_by_tax_household_for(enrollments_for_month, tax_household)
Expand Down
Loading
Loading