forked from moredip/caseflow-certification
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename granted substitution to appellant substitution (#16095)
Resolves nomenclature around "granted substitution". [Slack](https://dsva.slack.com/archives/CJL810329/p1617638837087900?thread_ts=1617635762.080200&cid=CJL810329) Original PR: Add New Model for Granted Substitutions #16032 ### Description The Board is not granting substitutions -- they are processing them. Caseflow should not present "Granted substitution" in the UI, so let's not call it that in the database. From Ann-Marie: > ... the appeal is not intaken if not granted by the AOJ so the substitution is granted, but not by the Board themselves > They don't want users in Caseflow to think they are granting the substitution which is why they do not want it reflected that way > Board policy is that the attorneys/VLJs cannot wait for substitution to be granted at the AOJ. They have to process a Death Dismissal even if substitution is pending at the AOJ. > The only time the Board would possibly grant substitution is if the substitution itself is appealed to the Board (type of contested claim) ### Acceptance Criteria - [ ] Code compiles correctly ### Database Changes *Only for Schema Changes* * [x] Timestamps (created_at, updated_at) for new tables * [x] Column comments updated * [x] Have your migration classes inherit from `Caseflow::Migration`, especially when adding indexes (use `add_safe_index`) * [x] Verify that `migrate:rollback` works as desired ([`change` supported functions](https://edgeguides.rubyonrails.org/active_record_migrations.html#using-the-change-method)) * [ ] ~Query profiling performed (eyeball Rails log, check bullet and fasterer output)~ * [x] Appropriate indexes added (especially for foreign keys, polymorphic columns, unique constraints, and Rails scopes) * [x] DB schema docs updated with `make docs` (after running `make migrate`) * [x] #appeals-schema notified with summary and link to this PR * [ ] ~Any non-obvious semantics or logic useful for interpreting database data is documented at [Caseflow Data Model and Dictionary](https://github.com/department-of-veterans-affairs/caseflow/wiki/Caseflow-Data-Model-and-Dictionary)~
- Loading branch information
Showing
11 changed files
with
167 additions
and
75 deletions.
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
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,48 @@ | ||
# frozen_string_literal: true | ||
|
||
# Model to store Appellant Substitution information captured from the Granted Substitution creation process | ||
|
||
class AppellantSubstitution < CaseflowRecord | ||
belongs_to :created_by, class_name: "User" | ||
belongs_to :source_appeal, class_name: "Appeal" | ||
belongs_to :target_appeal, class_name: "Appeal" | ||
|
||
validates :created_by, :source_appeal, :substitution_date, | ||
:claimant_type, :substitute_participant_id, | ||
:poa_participant_id, | ||
presence: true | ||
|
||
before_save :establish_appeal_stream | ||
|
||
attr_accessor :claimant_type | ||
|
||
def substitute_claimant | ||
Claimant.find_by(participant_id: substitute_participant_id) | ||
end | ||
|
||
def substitute_person | ||
Person.find_by(participant_id: substitute_participant_id) | ||
end | ||
|
||
def power_of_attorney | ||
BgsPowerOfAttorney.find_by(poa_participant_id: poa_participant_id) | ||
end | ||
|
||
private | ||
|
||
def establish_appeal_stream | ||
Claimant.create_without_intake!(participant_id: substitute_participant_id, payee_code: nil, type: claimant_type) | ||
unassociated_claimants = Claimant.where(participant_id: substitute_participant_id, decision_review: nil) | ||
self.target_appeal ||= source_appeal.create_stream(:substitution, new_claimants: unassociated_claimants) | ||
.tap do |target_appeal| | ||
# AOD Status: If the deceased appellant’s appeal was AOD, the substitute appellant will also receive | ||
# the benefit of the AOD status. This is the case for both situations where a case is returned to | ||
# the Board following the grant of a substitution request AND/OR pursuant to an appeal of a denial | ||
# of a substitution request. See 38 C.F.R. § 20.800(f). | ||
subtitute_person = target_appeal.claimant.person | ||
AdvanceOnDocketMotion.transfer_granted_motions_to_person(source_appeal, target_appeal, subtitute_person) | ||
|
||
InitialTasksFactory.new(target_appeal).create_root_and_sub_tasks! | ||
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 was deleted.
Oops, something went wrong.
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,31 @@ | ||
class RenameGrantedSubstitutions < Caseflow::Migration | ||
def up | ||
create_table :appellant_substitutions, comment: "Store appellant substitution form data" do |t| | ||
t.date "substitution_date", null: false, comment: "Date of substitution" | ||
t.string "substitute_participant_id", null: false, comment: "Participant ID of substitute appellant" | ||
t.string "poa_participant_id", null: false, comment: "Identifier of the appellant's POA, if they have a CorpDB participant_id" | ||
|
||
t.references :source_appeal, null: false, foreign_key: { to_table: :appeals }, comment: "The relevant source appeal for this substitution" | ||
t.references :target_appeal, null: false, foreign_key: { to_table: :appeals }, comment: "The new appeal resulting from this substitution" | ||
t.references :created_by, index: false, references: :users, null: false, foreign_key: { to_table: :users }, comment: "User that created this record" | ||
t.timestamps null: false, comment: "Standard created_at/updated_at timestamps" | ||
end | ||
|
||
drop_table :granted_substitutions | ||
end | ||
|
||
def down | ||
create_table :granted_substitutions, comment: "Store Granted Substitution form data" do |t| | ||
t.date "substitution_date", null: false, comment: "Date of granted substitution" | ||
t.references :substitute, index: false, references: :claimants, null: false, foreign_key: { to_table: :claimants }, comment: "References claimants table" | ||
t.string "poa_participant_id", null: false, comment: "Identifier of the appellant's POA, if they have a CorpDB participant_id" | ||
|
||
t.references :source_appeal, null: false, foreign_key: { to_table: :appeals }, comment: "The relevant source appeal for this substitution" | ||
t.references :target_appeal, null: false, foreign_key: { to_table: :appeals }, comment: "The new appeal resulting from this granted substitution" | ||
t.references :created_by, index: false, references: :users, null: false, foreign_key: { to_table: :users }, comment: "User that created this record" | ||
t.timestamps null: false, comment: "Standard created_at/updated_at timestamps" | ||
end | ||
|
||
drop_table :appellant_substitutions | ||
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
Oops, something went wrong.