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
Replicate prod bug: Case Movement user cannot reassign task #16206
Changes from 3 commits
1007e63
af573dd
77b3a9a
6c9140f
07c1181
eee36fe
95fddf8
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 |
---|---|---|
|
@@ -34,20 +34,6 @@ def configuration | |
sanitize_fields: %w[veteran_file_number], | ||
retrieval: ->(records) { records[Appeal].map(&:intake).compact.sort_by(&:id) } | ||
}, | ||
JudgeCaseReview => { | ||
sanitize_fields: %w[comment], | ||
retrieval: lambda do |records| | ||
judge_task_ids = Task.where(type: JudgeTask.descendants.map(&:name), appeal: records[Appeal]).ids | ||
JudgeCaseReview.where(task_id: judge_task_ids).order(:id) | ||
end | ||
}, | ||
AttorneyCaseReview => { | ||
sanitize_fields: %w[comment], | ||
retrieval: lambda do |records| | ||
atty_task_ids = Task.where(type: AttorneyTask.descendants.map(&:name), appeal: records[Appeal]).ids | ||
AttorneyCaseReview.where(task_id: atty_task_ids).order(:id) | ||
end | ||
}, | ||
DecisionDocument => { | ||
# citation_number must be unique and doesn't reference anything else in Caseflow, | ||
# so transform the number so we can import into the same DB as the original record | ||
|
@@ -64,6 +50,20 @@ def configuration | |
TaskTimer => { | ||
retrieval: ->(records) { TaskTimer.where(task_id: records[Task].map(&:id)).order(:id) } | ||
}, | ||
JudgeCaseReview => { | ||
sanitize_fields: %w[comment], | ||
retrieval: lambda do |records| | ||
judge_task_ids = Task.where(type: JudgeTask.descendants.map(&:name), appeal: records[Appeal]).ids | ||
JudgeCaseReview.where(task_id: judge_task_ids).order(:id) | ||
end | ||
}, | ||
AttorneyCaseReview => { | ||
sanitize_fields: %w[comment], | ||
retrieval: lambda do |records| | ||
atty_task_ids = Task.where(type: AttorneyTask.descendants.map(&:name), appeal: records[Appeal]).ids | ||
AttorneyCaseReview.where(task_id: atty_task_ids).order(:id) | ||
end | ||
}, | ||
RequestIssue => { | ||
sanitize_fields: ["notes", "contested_issue_description", /_(notes|text|description)/], | ||
retrieval: ->(records) { records[Appeal].map(&:request_issues).flatten.sort_by(&:id) } | ||
|
@@ -276,7 +276,7 @@ def id_offset | |
# Start with important types that other records will reassociate with | ||
def first_types_to_import | ||
# HearingDay is needed by Hearing | ||
@first_types_to_import ||= [Appeal, Organization, User, HearingDay] | ||
@first_types_to_import ||= [Appeal, Organization, User, HearingDay, Task] | ||
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. Ensure Tasks are one of the types imported before other records, i.e. CaseReviews, because CaseReviews rely on Tasks existing in the DB. |
||
end | ||
|
||
# During record creation, types where validation and callbacks should be avoided | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,6 +148,8 @@ def adjust_ids_by_offset(klass, obj_hash) | |
offset_id_table_fields[klass.table_name]&.each do |field_name| | ||
if obj_hash[field_name].is_a?(Array) | ||
obj_hash[field_name] = obj_hash[field_name].map { |id| id + @id_offset } | ||
elsif obj_hash[field_name].is_a?(String) | ||
obj_hash[field_name] = (obj_hash[field_name].to_i + @id_offset).to_s | ||
Comment on lines
+151
to
+152
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. CaseReview records use strings for |
||
elsif obj_hash[field_name] | ||
obj_hash[field_name] += @id_offset | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# frozen_string_literal: true | ||
|
||
require "helpers/sanitized_json_configuration.rb" | ||
require "helpers/sanitized_json_importer.rb" | ||
|
||
describe "CaseMovementTeam task actions" do | ||
# Ticket https://github.com/department-of-veterans-affairs/caseflow/issues/16205# | ||
# https://github.com/department-of-veterans-affairs/dsva-vacols/issues/187 | ||
# Target state: TBD -- see tcket | ||
describe "during Quality Review" do | ||
let!(:appeal) do | ||
sji = SanitizedJsonImporter.from_file("spec/records/scm-cant-reassign.json", verbosity: 5) | ||
sji.import | ||
sji.imported_records[Appeal.table_name].first | ||
end | ||
|
||
it "produces error and user can't reassign to attorney" do | ||
# To replicate error: | ||
# Clicking on "Assign to attorney" shows the "Assign task" modal. | ||
# Clicking on "Select a user" shows "Other". | ||
# Clicking on "Other" and starting to type "TALAM" shows the attorney. | ||
# Clicking Submit button shows an "Error assigning tasks" error banner in the modal | ||
# (and an error message in the DevTools console). | ||
end | ||
end | ||
end |
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.
Reordering so that these CaseReviews are exported after Tasks because they rely on tasks.