Skip to content
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

Upload method for 'Errors Found and Corrected' #23607

Draft
wants to merge 5 commits into
base: feature/APPEALS-49620-and-APPEALS-49626
Choose a base branch
from

Conversation

piedram
Copy link
Contributor

@piedram piedram commented Nov 22, 2024

Resolves APPEALS-64078

Description

As a Caseflow User I need to be able to click the submit button to upload the "final PDF" to the correct Appellants eFolder in VBMS so that the final PDF Transcript is uploaded Appellants eFolder in VBMS.

As a Caseflow Developer I need to;

  1. Create a new method on submit for 'Errors Found and Corrected' To Upload the PDF file "selected" by the End User from tmp
  • Upload the file to S3 and replace the previous file for the Hearing/Appellant
    DocketNumber_interenalHearingID_HearingClassName.pdf
  • Found in the transcription_files table, aws_link column for the pdf file
  • Upload the the same PDf file to the Appellants eFolder location in VBMS

Acceptance Criteria

  • Code compiles correctly

Frontend

  1. Open claseflow demo application.
  2. Login like a admin Hearing
  3. Go to demo/hearings/transcription_files
  4. Switch the view and select Hearing Admin Team cases
  5. Select any hearing with a Review Transcript task open
  6. In the action Select Errors found and corrected
  7. Choose the folder to upload
  8. Add description in the text area and click Upload to VBMS

Tests

Test Coverage

Did you include any test coverage for your code? Check below:

  • RSpec
  • Jest
  • Other

end

def error_found_upload_transcription_to_vbms; end
def error_found_upload_transcription_to_vbms
Copy link
Contributor

@wmedders21 wmedders21 Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should refactor to keep much of this logic abstracted out of the tasks_controller - much of whats going on here is not the responsibility of the tasks_controller. Method length is too long. Ruby methods should be 10 lines or less. Take a look at TranscriptionFileUpload class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

S3Service.store_file(s3_location(file_name), tmp_folder, :filepath)
rescue StandardError => error
Rails.logger.error "Error to upload #{file_name} to S3: #{error.message}"
raise BoxDownloadJobFileUploadError
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like incorrect error class - this upload doesn't seem related to a BoxDownloadJob

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

end
end

def s3_location(file_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like the responsibility of TranscriptionFileUpload

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


private

def split_filename(filename)
Copy link
Contributor

@wmedders21 wmedders21 Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will want "file_name" to be consistent throughout this file, rather than having both "filename" and "file_name"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

updated_at: Time.zone.now
)

Task.where(id: task.id).update_all(
Copy link
Contributor

@wmedders21 wmedders21 Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

task.update!...

We already have the task - no need to call where which returns an array - and update_all would imply there are multiples. Since we're querying on id, there can only be one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
end

def change_status_review_transcript_task
Copy link
Contributor

@wmedders21 wmedders21 Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method name should reflect exactly whats going on - perhaps complete_transcript_review. Since this is updating the status in a specific way, and also updating transcriptions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -51,6 +51,8 @@ class TasksController < ApplicationController
SplitAppealTask: SplitAppealTask
}.freeze

S3_BUCKET = "vaec-appeals-caseflow"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't being used here anymore and can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

)

render json: {
tasks: json_tasks(task.appeal.tasks.includes(*task_includes))[:data]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this is the correct json response we want to return after this call. json_tasks is meant to populate a queue table and is a large response with a lot of data. I don't see how the front end would be using any data from this response other than an ok status.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants