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

Add All Errors #413

Merged
merged 1 commit into from
Dec 11, 2023
Merged

Add All Errors #413

merged 1 commit into from
Dec 11, 2023

Conversation

analoo
Copy link
Contributor

@analoo analoo commented Nov 22, 2023

No description provided.

@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 November 22, 2023 19:33 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 November 28, 2023 19:38 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 November 30, 2023 20:46 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 November 30, 2023 21:55 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 November 30, 2023 23:35 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 November 30, 2023 23:43 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 December 1, 2023 18:19 Inactive
@analoo analoo marked this pull request as ready for review December 1, 2023 18:19
@analoo analoo changed the title Add errors in phase i Add errors in phase i - section 1 Dec 1, 2023
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 December 4, 2023 18:52 Inactive
@analoo analoo changed the title Add errors in phase i - section 1 Add errors in phase i - step 1 Dec 4, 2023
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 December 4, 2023 18:59 Inactive
@analoo analoo changed the title Add errors in phase i - step 1 Add errors in phase i - step 2 Dec 4, 2023
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 December 4, 2023 19:10 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 December 4, 2023 19:23 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 December 5, 2023 18:44 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 December 7, 2023 00:56 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 December 7, 2023 01:12 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 December 7, 2023 01:23 Inactive
@analoo analoo changed the title Add errors in phase i - step 2 Add All Errors Dec 7, 2023
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 December 7, 2023 19:16 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 December 7, 2023 19:36 Inactive
householdSsnInputs.add("");
}

ArrayList<LinkedHashMap> householdMembers = (ArrayList) submission.getInputData().get("household");
Copy link
Contributor

Choose a reason for hiding this comment

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

This section looks so much better ✨

Comment on lines +19 to +32
Map<String, List<String>> errorMessages = new HashMap<>();
Map<String, Object> inputData = formSubmission.getFormData();
String day = (String) inputData.get("householdMemberBirthDay");
String month = (String) inputData.get("householdMemberBirthMonth");
String year = (String) inputData.get("householdMemberBirthYear");

// valid range does not enforce year so added an additional validation here
if (!Pattern.matches("\\d{4}",year)) {
errorMessages.put(INPUT_NAME, List.of(translateMessage("error.format-dob")));
} else if(!this.validRange(month+"/"+day+"/"+year)){
errorMessages.put(INPUT_NAME, List.of(translateMessage("error.invalid-dob")));
}

return errorMessages;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not crucial - this looks like it could be extracted into a common method with the inputData keys as params

private final String ZIP_INPUT_NAME = "mailingAddressZipCode";

@Override
public Map<String, List<String>> runValidation(FormSubmission formSubmission, Submission submission) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here - seems like some of this can also be extracted into a common method?

@@ -41,6 +43,9 @@ public String getHeader() {
}

public void goBack() {
await().atMost(20, TimeUnit.SECONDS).until(
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets make this like 5 seconds. If it's taking longer than that, we should look into it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sree-cfa by default await takes 10 seconds and it was failing. It is for one specific test and it is flaky.

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 extended it to an atMost and set it to 20 minutes so that the flaky test would be less flaky.

Copy link
Contributor

@sree-cfa sree-cfa left a comment

Choose a reason for hiding this comment

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

👏

@Range(min=1, max=100)
@NotBlank
@Range(message="{error.invalid-range}", min=1, max=100)
@NotBlank(message="{error.missing-general}")
private String hoursPerWeek;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm noticing that this isn't getting repopulated if I go back to edit a user's information.

Perhaps this could be solved in a different PR, though, so this doesn't hold up this work.

Copy link
Contributor

@bseeger bseeger Dec 8, 2023

Choose a reason for hiding this comment

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

Page jobHoursPerWeek
If you fill out that page, click continue and then go back the data isn't there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bseeger - I looked into this one and it's unrelated to my PR but it is a fun find!

That page is using the Number template which is looking for the input key in the the input; however hours worked is nested so it can never find that value and therefore always defaults to blank: https://github.com/codeforamerica/la-doc-uploader/blob/738c4cfde27e76322cf0a3bd6c18264bebee4873/src/main/resources/templates/fragments/inputs/number.html#L27C15-L27C15

The number fragment is being used in the LA doc uploader so I think it will require a bit digging into to understand the implications of the change. SO for now, creating a follow up ticket (https://app.asana.com/0/1204547723915585/1206144609816303/f)

@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 December 11, 2023 18:33 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-413 December 11, 2023 18:43 Inactive
@analoo analoo merged commit f043c74 into main Dec 11, 2023
5 checks passed
@analoo analoo deleted the add-errors-in-phase-I branch December 11, 2023 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants