-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add Match Route Eleven as Clone of Provider Only Route #820
Merged
eanders
merged 5 commits into
release-60
from
dg/housing_navigation_rework_route_create_route_eleven-6123
Jun 24, 2024
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
### | ||
# Copyright 2016 - 2024 Green River Data Analysis, LLC | ||
# | ||
# License detail: https://github.com/greenriver/boston-cas/blob/production/LICENSE.md | ||
### | ||
|
||
module RouteElevenMailerMethods | ||
extend ActiveSupport::Concern | ||
included do | ||
def eleven_confirm_hsa_decline_dnd_staff(notification = nil) | ||
setup_instance_variables(notification) | ||
mail(to: @contact.email, subject: "Match Declined by #{Translation.translate('HSA Eleven')} - Requires Your Action") | ||
end | ||
|
||
def eleven_hsa_accepts_client_ssp_notification(notification = nil) | ||
setup_instance_variables(notification) | ||
mail(to: @contact.email, subject: "Match accepted by #{Translation.translate('HSA Eleven')}") | ||
end | ||
|
||
def eleven_hsa_accepts_client(notification = nil) | ||
setup_instance_variables(notification) | ||
mail(to: @contact.email, subject: 'Match ready for review - Requires Your Action') | ||
end | ||
|
||
def eleven_hsa_decision_client(notification = nil) | ||
setup_instance_variables(notification) | ||
mail(to: @contact.email, subject: "Decision from #{Translation.translate('Housing Subsidy Administrator Eleven')}") | ||
end | ||
|
||
def eleven_hsa_decision_hsp(notification = nil) | ||
setup_instance_variables(notification) | ||
mail(to: @contact.email, subject: "Decision from #{Translation.translate('Housing Subsidy Administrator Eleven')}") | ||
end | ||
|
||
def eleven_hsa_decision_shelter_agency(notification = nil) | ||
setup_instance_variables(notification) | ||
mail(to: @contact.email, subject: "Decision from #{Translation.translate('Housing Subsidy Administrator Eleven')}") | ||
end | ||
|
||
def eleven_hsa_decision_ssp(notification = nil) | ||
setup_instance_variables(notification) | ||
mail(to: @contact.email, subject: "Decision from #{Translation.translate('Housing Subsidy Administrator Eleven')}") | ||
end | ||
|
||
def eleven_match_initiation_for_hsa(notification = nil) | ||
setup_instance_variables(notification) | ||
mail(to: @contact.email, subject: 'New Housing Recommendation - Requires Your Action') | ||
end | ||
|
||
def eleven_match_initiation_for_shelter_agency(notification = nil) | ||
setup_instance_variables(notification) | ||
mail(to: @contact.email, subject: 'New Housing Recommendation') | ||
end | ||
|
||
def eleven_match_initiation_for_ssp(notification = nil) | ||
setup_instance_variables(notification) | ||
mail(to: @contact.email, subject: 'New Housing Recommendation') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
### | ||
# Copyright 2016 - 2024 Green River Data Analysis, LLC | ||
# | ||
# License detail: https://github.com/greenriver/boston-cas/blob/production/LICENSE.md | ||
### | ||
|
||
module RouteElevenDecisions | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
has_decision :eleven_hsa_acknowledges_receipt, decision_class_name: 'MatchDecisions::Eleven::ElevenHsaAcknowledgesReceipt', notification_class_name: 'Notifications::Eleven::MatchInitiationForHsa' | ||
has_decision :eleven_hsa_accepts_client, decision_class_name: 'MatchDecisions::Eleven::ElevenHsaAcceptsClient', notification_class_name: 'Notifications::Eleven::HsaAcceptsClient' | ||
has_decision :eleven_confirm_hsa_accepts_client_decline_dnd_staff, decision_class_name: 'MatchDecisions::Eleven::ElevenConfirmHsaAcceptsClientDeclineDndStaff', notification_class_name: 'Notifications::ConfirmHousingSubsidyAdminDeclineDndStaff' | ||
end | ||
end |
111 changes: 111 additions & 0 deletions
111
app/models/match_decisions/eleven/eleven_confirm_hsa_accepts_client_decline_dnd_staff.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,111 @@ | ||||
### | ||||
# Copyright 2016 - 2024 Green River Data Analysis, LLC | ||||
# | ||||
# License detail: https://github.com/greenriver/boston-cas/blob/production/LICENSE.md | ||||
### | ||||
|
||||
module MatchDecisions::Eleven | ||||
class ElevenConfirmHsaAcceptsClientDeclineDndStaff < ::MatchDecisions::Base | ||||
def to_partial_path | ||||
'match_decisions/eleven_confirm_hsa_accepts_client_decline_dnd_staff' | ||||
end | ||||
|
||||
def statuses | ||||
{ | ||||
pending: 'Pending', | ||||
decline_overridden: 'Decline Overridden', | ||||
decline_overridden_returned: 'Decline Overridden, Returned', | ||||
decline_confirmed: 'Decline Confirmed', | ||||
canceled: 'Canceled', | ||||
} | ||||
end | ||||
|
||||
def label | ||||
label_for_status status | ||||
end | ||||
|
||||
def label_for_status status | ||||
case status.to_sym | ||||
when :pending then "#{Translation.translate('CoC Eleven')} to confirm #{Translation.translate('Housing Subsidy Administrator Eleven')} decline" | ||||
when :decline_overridden then "#{Translation.translate('Housing Subsidy Administrator Eleven')} decline overridden by #{Translation.translate('CoC Eleven')}. Match successful" | ||||
when :decline_overridden_returned then "#{Translation.translate('Housing Subsidy Administrator Eleven')} decline overridden by #{Translation.translate('CoC Eleven')}. Match returned to #{Translation.translate('Housing Subsidy Administrator Eleven')}" | ||||
when :decline_confirmed then "Match rejected by #{Translation.translate('CoC Eleven')}" | ||||
when :canceled then canceled_status_label | ||||
end | ||||
end | ||||
|
||||
def step_name | ||||
"#{Translation.translate('CoC Eleven')} Reviews Match Declined by #{Translation.translate('HSA Eleven')}" | ||||
end | ||||
|
||||
def actor_type | ||||
Translation.translate('CoC Eleven') | ||||
end | ||||
|
||||
def contact_actor_type | ||||
nil | ||||
end | ||||
|
||||
def editable? | ||||
super && saved_status !~ /decline_overridden|decline_overridden_returned|decline_confirmed/ | ||||
end | ||||
|
||||
def initialize_decision! send_notifications: true | ||||
super(send_notifications: send_notifications) | ||||
update status: 'pending' | ||||
send_notifications_for_step if send_notifications | ||||
end | ||||
|
||||
def notifications_for_this_step | ||||
@notifications_for_this_step ||= [].tap do |m| | ||||
m << Notifications::Eleven::ConfirmHsaDeclineDndStaff | ||||
m << Notifications::Eleven::HsaDecisionClient | ||||
m << Notifications::Eleven::HsaDecisionSsp | ||||
m << Notifications::Eleven::HsaDecisionHsp | ||||
m << Notifications::Eleven::HsaDecisionShelterAgency | ||||
end | ||||
end | ||||
|
||||
def accessible_by? contact | ||||
contact.user_can_reject_matches? || contact.user_can_approve_matches? | ||||
end | ||||
|
||||
def show_client_match_attributes? | ||||
true | ||||
end | ||||
|
||||
class StatusCallbacks < StatusCallbacks | ||||
def pending | ||||
end | ||||
|
||||
def decline_overridden | ||||
match.succeeded!(user: user) | ||||
end | ||||
|
||||
def decline_overridden_returned | ||||
# Re-initialize the previous decision | ||||
match.eleven_hsa_accepts_client_decision.initialize_decision! | ||||
@decision.uninitialize_decision!(send_notifications: false) | ||||
end | ||||
|
||||
def decline_confirmed | ||||
match.rejected! | ||||
# TODO maybe rerun the matching engine for that vacancy and client | ||||
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. I think we can remove this:
Suggested change
|
||||
end | ||||
|
||||
def canceled | ||||
Notifications::MatchCanceled.create_for_match! match | ||||
match.canceled! | ||||
end | ||||
end | ||||
private_constant :StatusCallbacks | ||||
end | ||||
|
||||
def step_cancel_reasons | ||||
[ | ||||
'Vacancy should not have been entered', | ||||
'Vacancy filled by other client', | ||||
'Other', | ||||
] | ||||
end | ||||
end |
151 changes: 151 additions & 0 deletions
151
app/models/match_decisions/eleven/eleven_hsa_accepts_client.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
### | ||
# Copyright 2016 - 2024 Green River Data Analysis, LLC | ||
# | ||
# License detail: https://github.com/greenriver/boston-cas/blob/production/LICENSE.md | ||
### | ||
|
||
module MatchDecisions::Eleven | ||
class ElevenHsaAcceptsClient < ::MatchDecisions::Base | ||
def to_partial_path | ||
'match_decisions/eleven_hsa_accepts_client' | ||
end | ||
include MatchDecisions::AcceptsDeclineReason | ||
|
||
attr_accessor :building_id | ||
attr_accessor :unit_id | ||
|
||
# validate :note_present_if_status_declined | ||
|
||
def label | ||
label_for_status status | ||
end | ||
|
||
def label_for_status status | ||
case status.to_sym | ||
when :pending, :expiration_update then "#{Translation.translate('Housing Subsidy Administrator Eleven')} reviewing match" | ||
when :accepted then "Match accepted by #{Translation.translate('Housing Subsidy Administrator Eleven')}" | ||
when :declined then "Match declined by #{Translation.translate('Housing Subsidy Administrator Eleven')}. Reason: #{decline_reason_name}" | ||
when :canceled then canceled_status_label | ||
when :back then backup_status_label | ||
end | ||
end | ||
|
||
# if we've overridden this decision, indicate that (this is sent to the client) | ||
def status_label | ||
if match.eleven_confirm_hsa_accepts_client_decline_dnd_staff_decision.status == 'decline_overridden' | ||
'Approved' | ||
else | ||
statuses[status && status.to_sym] | ||
end | ||
end | ||
|
||
def step_name | ||
Translation.translate('Client Agrees to Match') | ||
end | ||
|
||
def actor_type | ||
Translation.translate('HSA Eleven') | ||
end | ||
|
||
def contact_actor_type | ||
:housing_subsidy_admin_contacts | ||
end | ||
|
||
def statuses | ||
{ | ||
pending: 'Pending', | ||
expiration_update: 'Pending', | ||
accepted: 'Accepted', | ||
declined: 'Declined', | ||
canceled: 'Canceled', | ||
back: 'Pending', | ||
} | ||
end | ||
|
||
def expires? | ||
true | ||
end | ||
|
||
def editable? | ||
super && saved_status !~ /accepted|declined/ | ||
end | ||
|
||
def initialize_decision! send_notifications: true | ||
super(send_notifications: send_notifications) | ||
update status: 'pending' | ||
send_notifications_for_step if send_notifications | ||
end | ||
|
||
def notifications_for_this_step | ||
@notifications_for_this_step ||= [].tap do |m| | ||
m << Notifications::Eleven::HsaAcceptsClient | ||
end | ||
end | ||
|
||
def notify_contact_of_action_taken_on_behalf_of contact: # rubocop:disable Lint/UnusedMethodArgument | ||
Notifications::OnBehalfOf.create_for_match! match, contact_actor_type | ||
end | ||
|
||
def accessible_by? contact | ||
contact.user_can_act_on_behalf_of_match_contacts? || | ||
contact.in?(match.housing_subsidy_admin_contacts) | ||
end | ||
|
||
def show_client_match_attributes? | ||
true | ||
end | ||
|
||
class StatusCallbacks < StatusCallbacks | ||
def pending | ||
end | ||
|
||
def accepted | ||
Notifications::Eleven::HsaAcceptsClientSspNotification.create_for_match! match | ||
match.succeeded!(user: user) | ||
end | ||
|
||
def declined | ||
match.eleven_confirm_hsa_accepts_client_decline_dnd_staff_decision.initialize_decision! | ||
end | ||
|
||
def canceled | ||
Notifications::MatchCanceled.create_for_match! match | ||
match.canceled! | ||
end | ||
|
||
def expiration_update | ||
end | ||
end | ||
private_constant :StatusCallbacks | ||
|
||
def step_decline_reasons(_contact) | ||
[ | ||
'Household could not be located', | ||
'Ineligible for Housing Program', | ||
'Client refused offer', | ||
'Health and Safety', | ||
'Other', | ||
] | ||
end | ||
|
||
def step_cancel_reasons | ||
[ | ||
'Vacancy should not have been entered', | ||
'Vacancy filled by other client', | ||
'Other', | ||
] | ||
end | ||
|
||
def whitelist_params_for_update params | ||
super.merge params.require(:decision).permit( | ||
:building_id, | ||
:unit_id, | ||
:shelter_expiration, | ||
) | ||
end | ||
|
||
private def note_present_if_status_declined | ||
errors.add :note, 'Please note why the match is declined.' if note.blank? && status == 'declined' | ||
end | ||
end | ||
end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How much would it break things if we started putting the decisions into a folder?
Seems like that would help tracking these down in the future for duplication etc.
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.
From an initial test, it doen't look like it is breaking anything, but I'll do a bit more to get some more thorough results before including in in the next commit.