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

msteele/APPEALS-24727 #19187

Merged
merged 26 commits into from
Aug 31, 2023
Merged

Conversation

msteele96
Copy link
Contributor

@msteele96 msteele96 commented Aug 14, 2023

Resolves APPEALS-24727

Description

Added validation to ensure that a given document series id exists within VBMS eFolder before allowing a HPR task to be created.

Acceptance Criteria

The value of the field labeled "Insert Caseflow Reader document hyperlink to request a hearing withdrawal" with be considered valid if:

  • The URL is of the following formatting:
    https://vefs-claimevidence-ui-..bip.va.gov/file/<document_series_reference_id of document>
  • The document_series_reference_id is found to correspond with a document in eFolder via a request to one of their endpoints.
  • The validation should take place onChange, but debounced. This meaning that validation logic should be executed X number of milliseconds after a user stops entering text into the field. Example
  • If validation fails then error text should be displayed above the field and the field should be highlighted in red.
  • Error for whenever the URL formatting is invalid: Please enter a valid document hyperlink
  • Error for whenever the URL does not correspond with a document in eFolder: Document could not be located in eFolder
    Refer to this Slack thread for further context: https://benefits-int-delivery.slack.com/archives/C03NCPYRXK2/p1687881917481399?thread_ts=1687878651.089549&cid=C03NCPYRXK2

Testing Plan

  1. Go to https://jira.devops.va.gov/browse/APPEALS-29003
  2. Go to https://jira.devops.va.gov/browse/APPEALS-29002
  • For feature branches merging into master: Was this deployed to UAT?

Frontend

User Facing Changes

  • Screenshots of UI changes added to PR & Original Issue

image

image

image

Best practices

Code Documentation Updates

  • Add or update code comments at the top of the class, module, and/or component.

Tests

Test Coverage

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

  • RSpec
  • Jest
  • Other

Code Climate

Your code does not add any new code climate offenses? If so why?

  • No new code climate issues added

Error Handling

  • Are errors being caught and handled gracefully?
  • Are appropriate error messages being displayed to users?
  • Are critical errors being reported to an error tracking system (e.g., Sentry, ELK)?
  • Are unhandled exceptions being caught at the application level ?

Exception Handling

  • Are custom exceptions defined and used where appropriate?
  • Is exception handling consistent throughout the codebase?
  • Are exceptions logged with relevant context and stack trace information?
  • Are exceptions being grouped and categorized for easier analysis and resolution?

@msteele96 msteele96 marked this pull request as draft August 14, 2023 18:54
@codeclimate
Copy link

codeclimate bot commented Aug 14, 2023

Code Climate has analyzed commit 7878988 and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1
Style 1

Note: there is 1 critical issue.

View more on Code Climate.

@jimfoley25 jimfoley25 self-requested a review August 23, 2023 13:19
@msteele96 msteele96 changed the base branch from master to feature/APPEALS-21339 August 23, 2023 15:44
@msteele96 msteele96 changed the title msteele/APPEALS 24727 msteele/APPEALS-24727 Aug 23, 2023
@@ -92,6 +92,18 @@ def document_count
handle_non_critical_error("document_count", error)
end

# series_id is lowercase, no curly braces because it comes from url
def document_lookup
series_id = "{#{params[:series_id]}}".upcase
Copy link
Contributor

Choose a reason for hiding this comment

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

series_id = params[:series_id].to_s.upcase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was from last story, but the curly braces are necessary for the lookup

# series_id is lowercase, no curly braces because it comes from url
def document_lookup
series_id = "{#{params[:series_id]}}".upcase
document = Document.find_by(series_id: series_id, file_number: appeal.veteran_file_number)
Copy link
Contributor

Choose a reason for hiding this comment

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

appeal&.veteran_file_number

def open_assign_hearing_disposition_task?
# ChangeHearingDispositionTask is a subclass of AssignHearingDispositionTask
disposition_task_names = [AssignHearingDispositionTask.name, ChangeHearingDispositionTask.name]
open_task = appeal.tasks.where(type: disposition_task_names).open.first
Copy link
Contributor

Choose a reason for hiding this comment

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

you can probably simplify this method by adding a scope method to the task model with something like scope ```
:open_disposition_task, -> {
tasks.where(type: [AssignHearingDispositionTask.name, ChangeHearingDispositionTask.name]).open.first
}

then just use `open_task = appeal.open_disposition_task`

@@ -18,8 +18,13 @@ def assign_to_organization_data(task, _user = nil)
end

def mail_assign_to_organization_data(task, user = nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

you should probably be able to use instance_of in both places in this method instead of is_a to narrow the type expectation even further

const errorMsg = dateValidationError(value);

setDateError(errorMsg);
validateDate?.(value !== '' && errorMsg === null);
Copy link
Contributor

Choose a reason for hiding this comment

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

suggest removing the ? as chaining is not needed here

client/app/queue/components/EfolderUrlField.jsx Outdated Show resolved Hide resolved
client/app/queue/components/EfolderUrlField.jsx Outdated Show resolved Hide resolved
Comment on lines +31 to +32
const checkIfDocumentExists = async () => {
setLoading(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Whenever the "Retry" button is pressed, will this function's invocation allow for the parent component's state to be updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've just updated the onclick of the retry button with the rest of the functionality from the debounce

Comment on lines 139 to 140
value={this.state.eFolderUrl}
valid={this.state.eFolderUrlValid}
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these two props able to be removed?

Comment on lines 114 to 118
appealId: PropTypes.string.isRequired,
requestType: PropTypes.string,
value: PropTypes.string,
errorMessage: PropTypes.string
errorMessage: PropTypes.string,
valid: PropTypes.bool
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
appealId: PropTypes.string.isRequired,
requestType: PropTypes.string,
value: PropTypes.string,
errorMessage: PropTypes.string
errorMessage: PropTypes.string,
valid: PropTypes.bool
appealId: PropTypes.string.isRequired,
requestType: PropTypes.string,
errorMessage: PropTypes.string

In case the value and valid props are no longer passed in.

Copy link
Contributor

@ThorntonMatthew ThorntonMatthew left a comment

Choose a reason for hiding this comment

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

LGTM!

@ThorntonMatthew ThorntonMatthew marked this pull request as ready for review August 31, 2023 14:38
@ThorntonMatthew ThorntonMatthew merged commit cfb6cd6 into feature/APPEALS-21339 Aug 31, 2023
10 of 14 checks passed
@ThorntonMatthew ThorntonMatthew deleted the msteele/APPEALS-24727 branch August 31, 2023 14:39
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.

3 participants