-
Notifications
You must be signed in to change notification settings - Fork 10
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
check create_renewals_on_date_change RR configs to display warning #4555
base: trunk
Are you sure you want to change the base?
Changes from 3 commits
803ebbf
0c50f3a
4436c9c
6bdf8d4
df1657d
ce46ac2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -467,5 +467,37 @@ def insurance_kind_select_options(kind) | |
[hr_kind(kind, insurance_kind), insurance_kind, {:'data-esi' => display_esi_fields?(insurance_kind, kind), :'data-mvsq' => display_minimum_value_standard_question?(insurance_kind)}] | ||
end | ||
end | ||
|
||
def benefit_coverage_period_info | ||
return @benefit_coverage_period_info if defined? @benefit_coverage_period_info | ||
|
||
current_hbx = HbxProfile.current_hbx | ||
is_under_open_enrollment = current_hbx.under_open_enrollment? | ||
latest_benefit_coverage_period = current_hbx.benefit_sponsorship.benefit_coverage_periods.last | ||
open_enrollment_start_on = latest_benefit_coverage_period.open_enrollment_start_on | ||
open_enrollment_end_on = latest_benefit_coverage_period.open_enrollment_end_on | ||
|
||
@benefit_coverage_period_info = { | ||
is_under_open_enrollment: is_under_open_enrollment, | ||
not_under_open_enrollment: !is_under_open_enrollment, | ||
open_enrollment_start_on: open_enrollment_start_on, | ||
open_enrollment_end_on: open_enrollment_end_on | ||
} | ||
end | ||
|
||
def can_display_coverage_update_reminder? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great idea adding these helper methods to abstract the logic out of the views! |
||
FinancialAssistanceRegistry.feature_enabled?(:oe_application_warning_display) && benefit_coverage_period_info[:is_under_open_enrollment] | ||
end | ||
|
||
def can_display_oe_application_warning? | ||
FinancialAssistanceRegistry.feature_enabled?(:oe_application_warning_display) && benefit_coverage_period_info[:not_under_open_enrollment] && (TimeKeeper.date_of_record >= bulk_application_renewal_trigger_date) | ||
end | ||
|
||
def bulk_application_renewal_trigger_date | ||
day = FinancialAssistanceRegistry[:create_renewals_on_date_change].settings(:renewals_creation_day).item | ||
month = FinancialAssistanceRegistry[:create_renewals_on_date_change].settings(:renewals_creation_month).item | ||
year = TimeKeeper.date_of_record.year | ||
Date.new(year, month, day) | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,14 +36,14 @@ | |
HbxProfile.any_instance.stub(:under_open_enrollment?).and_return(true) | ||
end | ||
|
||
And(/^it is before open enrollment$/) do | ||
oe_start_on = HbxProfile.current_hbx.benefit_sponsorship.benefit_coverage_periods.detect {|bcp| bcp.start_on.year == Date.today.year}.open_enrollment_start_on | ||
allow(TimeKeeper).to receive(:date_of_record).and_return Date.new(oe_start_on.year,10,27) | ||
And(/^current date is between renewals generation date and open enrollment start on$/) do | ||
oe_start_on = HbxProfile.current_hbx.benefit_sponsorship.benefit_coverage_periods.detect { |bcp| bcp.start_on.year == Date.today.year }.open_enrollment_start_on | ||
allow(TimeKeeper).to receive(:date_of_record).and_return Date.new(oe_start_on.year, 10, 27) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems virtually impossible that the renewals generation date would be after 10/27, but just noting that we have a hardcoded date here and the renewals generation date is env variable driven. |
||
end | ||
|
||
And(/^it is after open enrollment$/) do | ||
And(/^current date is outside renewals generation date and open enrollment start on$/) do | ||
oe_end_on = HbxProfile.current_hbx.benefit_sponsorship.benefit_coverage_periods.last.open_enrollment_end_on | ||
allow(TimeKeeper).to receive(:date_of_record).and_return Date.new(oe_end_on.year,2,15) | ||
allow(TimeKeeper).to receive(:date_of_record).and_return Date.new(oe_end_on.year, 2, 15) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar note as above-- there's probably no chance that the OE end date would be after 2/15, but that date is driven by a setting and this one is hardcoded. |
||
end | ||
|
||
And(/^current hbx is not under open enrollment$/) do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just sharing an opinion here-- I would lean towards the use of an existing method on the model, like
current_benefit_coverage_period
on theBenefitSponsorship
. I find the use of.last
as a proxy for "latest" a little fuzzy/brittle, at least in theory. Great variable name, tho; the intention is very clear!