Skip to content

Commit

Permalink
Feature/appeals 28087 36678 fy24 q3.2.0 merge (#21543)
Browse files Browse the repository at this point in the history
* APPEALS-36688- Build out Decision Review Created API route & Controller (#20569)

* added skeleton for api route

* removed duplicate code

* removed development envs for api and moved to creating an ApiKey

* removing any changes to development.rb

* removed extra auth code

* removed before action

---------

Co-authored-by: TuckerRose <tuckerrose@tuckerroses-mbp.lan>

* APPEALS-38232 -Build out Decision Review Created Event Failure API route & Controller (#20601)

* APPEALS-38232 - renamed controller to AC req, added decision_review_created_error endpoint, added decision_review_created_error method, and added RSpec for new method

* APPEALS-38232 - add comments to RSpec

* Jonathan/appeals 36684 (#20516)

* initial Events migration and model creation

* created model for DecisionReviewCreatedEvent

* updated comment with example

* added spec for DRCE model

* APPEALS-36684 created event_records migration and added polymorphic associations to specific models, and added rspec for the event_record model

* APPEALS-36684 - Updated RSpec tests and updated variables and got unhappy path to pass

* cleaned lint

* saving DRCE spec changes

* fixed spec test

* changed has_many to has_one

* updated event model spec

* added validation for ER poly associations

* changed association to has_one

* added new method and updated tests

* added foreign key after running checks

* some PR comment changes

* refactored methods in EventConcern

---------

Co-authored-by: Jonathan Tsang <tsang_jonathan@bah.com>
Co-authored-by: Enrilo Ugalde <ugalde_enrilo@bah.com>

* added migration, scopes and specs for events (#20707)

* fixed migration to update existing events table

* rollbacked to fix schema

* schema fixes

---------

Co-authored-by: TuckerRose <tuckerrose@tuckerroses-mbp.lan>

* Jr/APPEALS-38926  (#20714)

* APPEALS-38926 - Created DecisionReviewCreatedError Service Class, added logic for handling service error, updated DecisonReviewCreatedController, and DecisionReviewCreatedController spec, with the updated service logic

* APPEALS-38926- created RSpec Test for DecisionReviewCreatedError Service Class and edited the Rails.logger for the service class

* APPEALS-38926 Added new info column to update transaction and added it to the RSpec test

* APPEALS-38926 - added comments to the Service Class

* APPEALS-38926 - Code Changes from TL Code Review, added rescues and fails

* APPEALS-38926 - fixed lint

* Jonathan/appeals 36689 (#20671)

* created new service class

* add rspec test cases

* service class methods

* controller action and spec

* controller update

* CC fixes

* removed accidental line

* changed to find_or_create_by

* reworked error for redis lock

* additional rspec for controller

* fixed test

* rspec fix

* delete lock key afterwards

* moved Event creation back into lock block

---------

Co-authored-by: Jonathan Tsang <tsang_jonathan@bah.com>

* APPEALS-39663 Create CreateUserOnEvent service class and add logic to create user if needed (#20838)

* added user creation class & test

* removed extra lines

* add comment to class

* added context for args from avro

---------

Co-authored-by: Jonathan Tsang <tsang_jonathan@bah.com>

* Jr/APPEALS-39664 (#20898)

* APPEALS-39664 - Created updated_vacols_on_optin module class, and removed  extra private

* APPEALS-39664 - created UpdatedVacolsOnOptin module, RSpec file, as well as sudo code for SOC and SSOC optin check in main service class DecisionReviewCreated

* APPEALS-39664 - Created RSpec Test - PASS,  Updated method name.

* APPEALS-39664 - Added Error Handling to Sub Service Class

* APPEALS-39664 - Removed un-needed comments

* APPEALS-39664 - added include for the module UpdateVacolsOnOptin inside decision_review_created service

* APPEALS-39664 - Added Custom Error , and updated all .perform! to .process!

* APPEALS-39664 - Updated RSpec Test to reflect changes - all pass

* Updated comment for decision_review_created Service Class

* Will/appeals 36691 (#20909)

* Created attribute for failed claims on event and displaying failed claim

* passing all failed events back to serializer

* added controller tests for failed_claims and added class method for finding claims on events

* renamed failed_claims to claim_errors

---------

Co-authored-by: TuckerRose <tuckerrose@tuckerroses-mbp.lan>

* JR/APPEALS-40954 Create CreateIntake service class and add logic to create Intake (#20967)

* APPEALS-40954 - Added Sudo Code for CreateIntake Logic

* APPEALS-40954 - added logic to CreateIntake module

* APPEALS-40954 - added Create Intake spec  with error handling - All pass

* APPEALS-40954 - Added CreateIntake Module to DecisionReviewCreated Main Service

* APPEALS-40954 - updated folder name and namespace

* APPEALS-40954 - Updated RSpec to match folder

* APPEALS-40954- Upated decision review created servie include to match folder

* Fixed failing test due to folder structure change

* Jonathan/appeals 40950 (#20965)

* Added new veteran creation module

* saving test changes

* rspec

* fixed datetime assign

* renamed var

---------

Co-authored-by: Jonathan Tsang <tsang_jonathan@bah.com>

* APPEALS-40950 - update var veteran to vbms_veteran (#21050)

* APPEALS-40950 - update var veteran to vbms_veteran

* updated private method in controller to match happy path params dcr to drc

* Create CreateClaimantOnEvent service class and add logic to create claimant if needed (#21044)

* created service class and basic unit tests

* added conditionals for veteran claimants and will create veteran claimant now

* modified create claimant to use eventing data

* change to a class

* creating claimant correctly

* test fixes

* removed old comments

* fixed type for veteran_is_not_claimant

* changed specs to match pulling out hash params and removed event.reference id

* moved back to dot notation

* updated comments

* fixed create claimant issue

* updated process to use bang method and returning claimant

---------

Co-authored-by: TuckerRose <tuckerrose@tuckerroses-mbp.lan>

* APPEALS-41968 Modify Issues Endpoints & Update Metric Service Logic (#21108)

* moved metricsService call to top of method

* modified rspec case

* moved metric logging spec case higher up

---------

Co-authored-by: Jonathan Tsang <tsang_jonathan@bah.com>

* Resolved merge conflicts while merging master into feature/APPEALS-28… (#21167)

* Jonathan/APPEALS-41957 (#21171)

* added interface + parser class

* edited veteran parse methods

* renamed var to "payload"

* started refactor

* more refactor + rspec

* added EPE attr

* dateTime conversions

* added class comments

* rubocop lint changes

* fixed test case

---------

Co-authored-by: Jonathan Tsang <tsang_jonathan@bah.com>

* Jr/appeals 41931 (#21192)

* APPEALS-41931 - Created create_ep_establishment file and class

* APPEALS-41931 - added process! method that creates epe from payload

* APPEALS-41931 - added logic for EventRecord being created and error handling

* APPEALS-41931 - added comments to process method

* APPEALS-41931 - set up rspec test

* APPEALS-41931 - removed lint

* APPEALS-41931-created Rspec and Test Pass

* APPEALS-41931 - cleaned lint and added error test 100% code coverage

* APPEALS-41931- fixed lint

* APPEALS-41931- fixed lint and fixed %100 code cov

* APPEALS-41931 - cleaned up lint and warn for Service Class

* APPEALS-41931 - Added CreateEpEstablishment.process! to the decision_review_created Parent Service Class

* APPEALS-41931 - refactor code to implement new parser

* fixed linting issues

* APPEALS-41931 - Updated Comments for CreateEpEstablishment

* APPEALS-41931 - moved logical date int to parser and refactored code in Class and RSepc

* edits

* Will/appeals 41929 (#21205)

* added an error and commented out call for createclaim

* added new parser logic

* merge request changes

* fixed rubocop issues and added checks for claim review attributes

---------

Co-authored-by: TuckerRose <tuckerrose@tuckerroses-mbp.lan>

* APPEALS-42631- Create Rspec for Parser with sample payload method, and add additional parser methods  (#21294)

* APPEALS-42631 - create example.json

* APPEALS-42631 - implemented example_response and load_example method and works as expected

* APPEALS-42631 - created RSpec for DecisionReviewCreatedParser

* APPEALS-42631 - Refactored parser and Added RSpec for current praser

* APPEALS-42631 - added methods to parser for intake, claimant, and claim_review and added matching rspec for new methods

* APPEALS-42631 - updated code per TL Comments

* APPEALS-421631- added additional comments and fixing lint

* APPEALS-41934 (#21251)

* initial commit

* implementation & error

* renamed method

* rspec

* saving refactor progress

* finished refactoring class

* added comment

* minor parser/rspec updates

---------

Co-authored-by: Jonathan Tsang <tsang_jonathan@bah.com>

* added RI parser methods to rspec (#21322)

* added RI parser methods to rspec

* updated config for Consumer

---------

Co-authored-by: Jonathan Tsang <tsang_jonathan@bah.com>

* Update DecisionReviewCreated to make all calls and link all intake records (#21334)

* updated decision review created to uncomment actions and updated specs

* remove binding.pry

* removed comments

* fixed a bunch of broken tests

* fixed last broken tests

* fixed params for methods and specs

---------

Co-authored-by: TuckerRose <tuckerrose@tuckerroses-mbp.lan>

* APPEALS-43446- Change name of BackfillRecord polymorphic model to EventedRecord (#21382)

* APPEALS-43446 - renamed columns for backfill record to evented record migrate and rollback work as intended

* APPEALS-43446 replaced all backfill_record with evented_record within the models associations and updated Rspec tests

* APPEALS-43446 fixed error message

* Jr/ama controller refactor (#21365)

* fixed test and refactored controller

* saving changes

* init commit passing all the way to request_issues

* all pass and functions as expected

* lint

* lint

* updated initializer to use deep_symbolize_keys

* updated headers to be more dry

* added missing Intake attributes

* fixed failing tests

* updated createIntake test

* fixed veteran rspec

* fixed RI test

* APPEALS-43446- Change name of BackfillRecord polymorphic model to EventedRecord (#21382)

* APPEALS-43446 - renamed columns for backfill record to evented record migrate and rollback work as intended

* APPEALS-43446 replaced all backfill_record with evented_record within the models associations and updated Rspec tests

* APPEALS-43446 fixed error message

* updated intake

* modified intake

---------

Co-authored-by: Jonathan Tsang <tsang_jonathan@bah.com>

* redo init commit

* updated imp. logic

* attorney widget fix

* Create end to end , happy path rspec's for Decision Created event Feature (#21395)

* updated more tests and fixed user creation

* added in person creation

* corrected headers and fixed broken tests

* added type

* fixed failing spec

* creating event when person is created

* updated spec to account for both events being created

* ignored long lines for spec file

* linting fixes

* fixed more linting errors/ ignored long lines

---------

Co-authored-by: TuckerRose <tuckerrose@tuckerroses-mbp.lan>

* Jonathan/appeals 43589 (#21397)

* saving

* saving user class error progress

* error handling for user creation

* updated error handling/raises

* validator methods

* validations

* update logical date converter

* changed veteran service class to use file_number

* added fields to hlr

* updated epe data

* removed byebug

* fixed typos

* Edit 5: adding detail_id to Intake

* EDIT 6: add claimant_participant_id to epe

* Edit 8: Intake is correctly linked to veteran

* Edit 7: RI additions

* fixed spacing

* fixed typo

* saving rspec changes

* rspec updates

* added datetime conversion for person dob

* fixed rspec

* remove unused methods

---------

Co-authored-by: Jonathan Tsang <tsang_jonathan@bah.com>

* feature/APPEALS-35707-29633-29632 (uat) (#21435)

* 🔀 Squash merge AlecK/APPEALS-35707 - Replace `database_cleaner` with `database_cleaner-active_record`

* 🔀 Squash merge jcroteau/APPEALS-29632-fix-deprecation-action-view-base-instances

* 🔀 Squash merge jcroteau/APPEALS-29633-fix-deprecation-warning-active_record-result-to_hash

---------

Co-authored-by: Will Love <wlove29@gmail.com>
Co-authored-by: TuckerRose <tuckerrose@tuckerroses-mbp.lan>
Co-authored-by: Enrilo Ugalde <71367882+Jruuuu@users.noreply.github.com>
Co-authored-by: Jonathan Tsang <98970951+jtsangVA@users.noreply.github.com>
Co-authored-by: Jonathan Tsang <tsang_jonathan@bah.com>
Co-authored-by: Enrilo Ugalde <ugalde_enrilo@bah.com>
Co-authored-by: isaiahsaucedo <irsaucedo5@gmail.com>
Co-authored-by: Calvin <Calvin.Costa@va.gov>
Co-authored-by: Craig Reese <Reese_Craig@bah.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
  • Loading branch information
11 people authored May 3, 2024
1 parent 8911a72 commit 94896ad
Show file tree
Hide file tree
Showing 67 changed files with 3,000 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# frozen_string_literal: true

class Api::Events::V1::DecisionReviewCreatedController < Api::ApplicationController
def decision_review_created
consumer_event_id = drc_params[:event_id]
claim_id = drc_params[:claim_id]
headers = request.headers
::Events::DecisionReviewCreated.create!(consumer_event_id, claim_id, headers, drc_params)
render json: { message: "DecisionReviewCreatedEvent successfully processed and backfilled" }, status: :created
rescue Caseflow::Error::RedisLockFailed => error
render json: { message: error.message }, status: :conflict
rescue StandardError => error
render json: { message: error.message }, status: :unprocessable_entity
end

def decision_review_created_error
event_id = drc_error_params[:event_id]
errored_claim_id = drc_error_params[:errored_claim_id]
error_message = drc_error_params[:error]
::Events::DecisionReviewCreatedError.handle_service_error(event_id, errored_claim_id, error_message)
render json: { message: "Decision Review Created Error Saved in Caseflow" }, status: :created
rescue Caseflow::Error::RedisLockFailed => error
render json: { message: error.message }, status: :conflict
rescue StandardError => error
render json: { message: error.message }, status: :unprocessable_entity
end

private

def drc_error_params
params.permit(:event_id, :errored_claim_id, :error)
end

def drc_params
params.permit(:event_id,
:claim_id,
:css_id,
:detail_type,
:station,
intake: {},
veteran: {},
claimant: {},
claim_review: {},
end_product_establishment: {},
request_issues: [:benefit_type,
:contested_issue_description,
:contention_reference_id,
:contested_rating_decision_reference_id,
:contested_rating_issue_profile_date,
:contested_rating_issue_reference_id,
:contested_decision_issue_id,
:decision_date,
:ineligible_due_to_id,
:ineligible_reason,
:is_unidentified,
:unidentified_issue_text,
:nonrating_issue_category,
:nonrating_issue_description,
:untimely_exemption,
:untimely_exemption_notes,
:vacols_id,
:vacols_sequence_id,
:closed_at,
:closed_status,
:contested_rating_issue_diagnostic_code,
:ramp_claim_id,
:rating_issue_associated_at,
:nonrating_issue_bgs_id]
)
end
end
14 changes: 7 additions & 7 deletions app/controllers/api/v3/issues/ama/veterans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ class Api::V3::Issues::Ama::VeteransController < Api::V3::BaseController
end

def show
veteran = find_veteran
page = init_page
per_page = init_per
if veteran
MetricsService.record("Retrieving AMA Request Issues for Veteran: #{veteran.participant_id}",
service: "AMA Request Issue endpoint",
name: "VeteransController.show") do
MetricsService.record("Retrieving AMA Request Issues for Veteran with participant ID: #{params[:participant_id]}",
service: "AMA Request Issue endpoint",
name: "VeteransController.show") do
veteran = find_veteran
page = init_page
per_page = init_per
if veteran
render_request_issues(Api::V3::Issues::Ama::VbmsAmaDtoBuilder.new(veteran, page, per_page).hash_response)
end
end
Expand Down
16 changes: 8 additions & 8 deletions app/controllers/api/v3/issues/vacols/veterans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ def file_number
end

def show
page = ActiveRecord::Base.sanitize_sql(params[:page].to_i) if params[:page]
# per_page uses the default value defined in the DtoBuilder unless a param is given,
# but it cannot exceed the upper bound
per_page = [params[:per_page].to_i, DEFAULT_UPPER_BOUND_PER_PAGE].min if params[:per_page]&.to_i&.positive?
# Disallow page(0) since page(0) == page(1) in kaminari. This is to avoid confusion.
(page.nil? || page <= 0) ? page = 1 : page ||= 1

MetricsService.record("VACOLS: Get VACOLS Issues information for Veteran",
name: "Api::V3::Issues::Vacols::VeteransController.show") do
name: "Api::V3::Issues::Vacols::VeteransController.show") do
page = ActiveRecord::Base.sanitize_sql(params[:page].to_i) if params[:page]
# per_page uses the default value defined in the DtoBuilder unless a param is given,
# but it cannot exceed the upper bound
per_page = [params[:per_page].to_i, DEFAULT_UPPER_BOUND_PER_PAGE].min if params[:per_page]&.to_i&.positive?
# Disallow page(0) since page(0) == page(1) in kaminari. This is to avoid confusion.
(page.nil? || page <= 0) ? page = 1 : page ||= 1

render_vacols_issues(Api::V3::Issues::Vacols::VbmsVacolsDtoBuilder.new(@veteran, page, per_page))
end
end
Expand Down
7 changes: 6 additions & 1 deletion app/models/claim_review.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ClaimReview < DecisionReview

has_many :end_product_establishments, as: :source
has_many :messages, as: :detail

has_one :event_record, as: :evented_record
with_options if: :saving_review do
validate :validate_receipt_date
validate :validate_veteran
Expand Down Expand Up @@ -301,6 +301,11 @@ def cleared_nonrating_ep?
processed? && cleared_end_products.any?(&:nonrating?)
end

def from_decision_review_created_event?
# refer back to the associated Intake to see if both objects came from DRCE
intake ? intake.from_decision_review_created_event? : false
end

def sct_appeal?
false
end
Expand Down
6 changes: 6 additions & 0 deletions app/models/claimant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Claimant < CaseflowRecord
has_one :unrecognized_appellant, lambda { |claimant|
where(id: UnrecognizedAppellant.order(:id).find_by(claimant: claimant)&.id)
}, dependent: :destroy
has_one :event_record, as: :evented_record

# rubocop:disable Rails/UniqueValidationWithoutIndex
validates :participant_id,
Expand Down Expand Up @@ -86,6 +87,11 @@ def find_power_of_attorney
# no-op except on BgsRelatedClaimants
end

def from_decision_review_created_event?
# refer back to the associated Person record to see if both objects came from DRCE
person.from_decision_review_created_event?
end

private

def bgs_address_service
Expand Down
24 changes: 24 additions & 0 deletions app/models/concerns/event_concern.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

# This concern is used to identify objects associated with Appeals-Consumer Events.
module EventConcern
extend ActiveSupport::Concern

# Check if this object is associated with any Event, regardless of type
# check if this object exists in the Event Records table
def from_event?
event_record.present?
end

# Check if this object is associated with a DecisionReviewCreatedEvent
def from_decision_review_created_event?
if from_event?
# retrieve the record and the event the record is tied to
event = event_record.event

event.type == DecisionReviewCreatedEvent.name
else
false
end
end
end
6 changes: 6 additions & 0 deletions app/models/end_product_establishment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class EndProductEstablishment < CaseflowRecord
has_many :effectuations, class_name: "BoardGrantEffectuation"
has_many :end_product_updates
has_one :priority_end_product_sync_queue
has_one :event_record, as: :evented_record
belongs_to :vbms_ext_claim, foreign_key: "reference_id", primary_key: "claim_id", optional: true

# :block => 1 # Specify in seconds how long you want to wait for the lock to be released.
Expand Down Expand Up @@ -383,6 +384,11 @@ def status_type_code
end
end

def from_decision_review_created_event?
# refer back to the associated Intake to see if both objects came from DRCE
source.intake.from_decision_review_created_event?
end

private

def status_type
Expand Down
7 changes: 7 additions & 0 deletions app/models/events/decision_review_created_event.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

# This class represents the DecisionReviewCreatedEvent info that is POSTed to Caseflow
# Represents a single "event" and is tied to "event records" that contain info regarding
# the different objects that Caseflow performs backfill creations for after VBMS Intake.
class DecisionReviewCreatedEvent < Event
end
19 changes: 19 additions & 0 deletions app/models/events/event.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

# This class is the parent class for different events that Caseflow receives from appeals-consumer
class Event < CaseflowRecord
has_many :event_records
store_accessor :info, :errored_claim_id

scope :with_errored_claim_id, -> { where.not("info -> 'errored_claim_id' IS NULL") }

def completed?
completed_at?
end

def self.find_errors_by_claim_id(claim_id)
with_errored_claim_id
.where("info ->> 'errored_claim_id' = ?", claim_id)
.pluck(:error)
end
end
28 changes: 28 additions & 0 deletions app/models/events/event_record.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

class EventRecord < CaseflowRecord
belongs_to :event
belongs_to :evented_record, polymorphic: true

validate :valid_evented_record

def valid_evented_record
unless %w[
Intake
ClaimReview
HigherLevelReview
SupplementalClaim
EndProductEstablishment
Claimant
Veteran
Person
RequestIssue
LegacyIssue
LegacyIssueOptin
User
].include?(evented_record_type)

errors.add(:evented_record_type, "is not a valid evented record")
end
end
end
1 change: 1 addition & 0 deletions app/models/higher_level_review.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class HigherLevelReview < ClaimReview
end

has_many :remand_supplemental_claims, as: :decision_review_remanded, class_name: "SupplementalClaim"
has_one :event_record, as: :evented_record

attr_accessor :appeal_split_process

Expand Down
2 changes: 2 additions & 0 deletions app/models/intake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

class Intake < CaseflowRecord
class FormTypeNotSupported < StandardError; end
include EventConcern

belongs_to :user
belongs_to :veteran
belongs_to :detail, polymorphic: true
has_one :event_record, as: :evented_record

COMPLETION_TIMEOUT = 5.minutes
IN_PROGRESS_EXPIRES_AFTER = 1.day
Expand Down
6 changes: 6 additions & 0 deletions app/models/legacy_issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
class LegacyIssue < CaseflowRecord
belongs_to :request_issue
has_one :legacy_issue_optin
has_one :event_record, as: :evented_record

validates :request_issue, presence: true

def from_decision_review_created_event?
# refer back to the associated Intake to see if both objects came from DRCE
request_issue&.from_decision_review_created_event?
end
end
6 changes: 6 additions & 0 deletions app/models/legacy_issue_optin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class LegacyIssueOptin < CaseflowRecord
belongs_to :request_issue
belongs_to :legacy_issue
has_one :event_record, as: :evented_record

VACOLS_DISPOSITION_CODE = "O" # oh not zero
REMAND_DISPOSITION_CODES = %w[3 L].freeze
Expand Down Expand Up @@ -109,6 +110,11 @@ def vacols_issue
AppealRepository.issues(vacols_id).find { |issue| issue.vacols_sequence_id == vacols_sequence_id }
end

def from_decision_review_created_event?
# refer back to the associated Intake to see if both objects came from DRCE
request_issue&.from_decision_review_created_event?
end

private

def revert_open_remand_issues
Expand Down
2 changes: 2 additions & 0 deletions app/models/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
class Person < CaseflowRecord
include AssociatedBgsRecord
include BgsService
include EventConcern

has_many :advance_on_docket_motions
has_many :claimants, primary_key: :participant_id, foreign_key: :participant_id
has_one :event_record, as: :evented_record
validates :participant_id, presence: true

CACHED_BGS_ATTRIBUTES = [
Expand Down
6 changes: 6 additions & 0 deletions app/models/request_issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class RequestIssue < CaseflowRecord
has_many :hearing_issue_notes
has_one :legacy_issue_optin
has_many :legacy_issues
has_one :event_record, as: :evented_record
belongs_to :correction_request_issue, class_name: "RequestIssue", foreign_key: "corrected_by_request_issue_id"
belongs_to :ineligible_due_to, class_name: "RequestIssue", foreign_key: "ineligible_due_to_id"
belongs_to :contested_decision_issue, class_name: "DecisionIssue"
Expand Down Expand Up @@ -753,6 +754,11 @@ def timely_issue?(receipt_date)
decision_date >= (receipt_date - Rating::ONE_YEAR_PLUS_DAYS)
end

def from_decision_review_created_event?
# refer back to the associated Intake to see if both objects came from DRCE
decision_review&.from_decision_review_created_event?
end

private

def create_legacy_issue!
Expand Down
1 change: 1 addition & 0 deletions app/models/supplemental_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class SupplementalClaim < ClaimReview
END_PRODUCT_MODIFIERS = %w[040 041 042 043 044 045 046 047 048 049].freeze

belongs_to :decision_review_remanded, polymorphic: true
has_one :event_record, as: :evented_record

scope :updated_since_for_appeals, lambda { |since|
select(:decision_review_remanded_id)
Expand Down
5 changes: 5 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

class User < CaseflowRecord # rubocop:disable Metrics/ClassLength
include BgsService
<<<<<<< HEAD
include EventConcern
=======
include ConferenceableConcern
>>>>>>> uat/FY24Q3.2.0

has_many :dispatch_tasks, class_name: "Dispatch::Task"
has_many :document_views
Expand All @@ -18,6 +22,7 @@ class User < CaseflowRecord # rubocop:disable Metrics/ClassLength
has_many :decided_membership_requests, class_name: "MembershipRequest", foreign_key: :decider_id
has_many :messages
has_many :unrecognized_appellants, foreign_key: :created_by_id
has_one :event_record, as: :evented_record
has_one :vacols_user, class_name: "CachedUser", foreign_key: :sdomainid, primary_key: :css_id
has_one :vacols_staff, class_name: "VACOLS::Staff", foreign_key: :sdomainid, primary_key: :css_id

Expand Down
2 changes: 2 additions & 0 deletions app/models/veteran.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
# rubocop:disable Metrics/ClassLength
class Veteran < CaseflowRecord
include AssociatedBgsRecord
include EventConcern

has_many :correspondences
has_many :available_hearing_locations,
foreign_key: :veteran_file_number,
primary_key: :file_number, class_name: "AvailableHearingLocations"
has_one :event_record, as: :evented_record

bgs_attr_accessor :ptcpnt_id, :sex, :address_line1, :address_line2,
:address_line3, :city, :state, :country, :zip_code,
Expand Down
Loading

0 comments on commit 94896ad

Please sign in to comment.