Skip to content

Commit

Permalink
[CCAP-327] - implement bachelors screens (#546)
Browse files Browse the repository at this point in the history
  • Loading branch information
analoo authored Aug 26, 2024
1 parent 183b091 commit 6e0c73c
Show file tree
Hide file tree
Showing 13 changed files with 187 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/ilgcc/app/inputs/Gcc.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ public class Gcc extends FlowInputs {
// activities-work-commute-time
private String activitiesJobCommuteTime;

// parent-info-bachelors
private String applicantHasBachelorsDegree;

// activities-ed-program-type
@NotBlank(message = "{errors.select-one-option}")
private String educationType;
Expand Down Expand Up @@ -342,6 +345,9 @@ public class Gcc extends FlowInputs {
@Pattern(regexp = "^\\d{5}(?:-\\d{4})?$", message = "{errors.invalid-zipcode}")
private String partnerEmployerZipCode;

// parent-partner-info-bachelors
private String partnerHasBachelorsDegree;

// activities-partner-ed-program-type
@NotBlank(message = "{errors.select-one-option}")
private String partnerEducationType;
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/org/ilgcc/app/pdf/ParentPartnerPreparer.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,14 @@ public Map<String, SubmissionField> prepareSubmissionFields(Submission submissio
String educationTypePrefix = "PARTNER";
String educationTypeField = PreparerUtilities.getEducationTypeFieldValue(
(String) submission.getInputData().getOrDefault("partnerEducationType", ""), educationTypePrefix);
results.put("partnerEducation",
new
results.put("partnerEducation", new SingleField("partnerEducation", educationTypeField, null));

SingleField("partnerEducation", educationTypeField, null));
var partnerHighestEducation = submission.getInputData().getOrDefault("partnerHasBachelorsDegree", "");

if(partnerHighestEducation.equals("true")){
results.put("partnerEducationHighestLevel",
new SingleField("partnerEducationHighestLevel", "BA degree", null));
}

return results;
}
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/org/ilgcc/app/pdf/ParentPreparer.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,15 @@ public Map<String, SubmissionField> prepareSubmissionFields(Submission submissio
} else if (parentGender.contains("NONBINARY")){
results.put("parentGenderTNB", new SingleField("parentGenderTNB", "Nonbinary", null));
}

}

var applicantHighestEducation = inputData.getOrDefault("applicantHasBachelorsDegree", "");

if(applicantHighestEducation.equals("true")){
results.put("applicantEducationHighestLevel",
new SingleField("applicantEducationHighestLevel", "BA degree", null));
}

return results;
}

Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/flows-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ flow:
nextScreens:
- name: activities-add-jobs
activities-add-ed-program:
nextScreens:
- name: parent-info-bachelors
parent-info-bachelors:
nextScreens:
- name: activities-ed-program-type
activities-ed-program-type:
Expand Down Expand Up @@ -280,6 +283,9 @@ flow:
nextScreens:
- name: activities-partner-add-job
activities-partner-add-ed-program:
nextScreens:
- name: parent-partner-info-bachelors
parent-partner-info-bachelors:
nextScreens:
- name: activities-partner-ed-program-type
activities-partner-ed-program-type:
Expand Down
15 changes: 13 additions & 2 deletions src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,11 @@ activities-work-commute-time.default.option=Select commute time
activities-ed-program.title=School or training program
activities-add-ed-program.header=Tell us about {0}''s school or training program
activities-add-ed-program.subtext=We will ask for program info and class schedule. You may be asked to submit your GPA at the end of the semester.
activities-partner-add-ed-program.header=Now tell us about {0}''s school or training program
activities-partner-add-ed-program.subtext=We will ask for program info and class schedule. You may be asked to submit their GPA at the end of the semester.

# parent-info-bachelors
parent-info-bachelors.title=Parent info bachelors
parent-info-bachelors.header=Do you have a Bachelor's degree?

#activities-ed-program-type
activities-ed-program-type.header=What type of school or training are you enrolled in?
activities-ed-program-type.belowPostSecondary=Below post-secondary
Expand Down Expand Up @@ -517,6 +520,14 @@ activities-partner-commute-time.subtext=Their travel time will be added to their
activities-partner-add-job.header.any-other-jobs=Does {0} have any other jobs?
activities-partner-add-job.subtext.add-jobs-list=We will ask for their work schedule for each job.

# activities-partner-add-ed-program
activities-partner-add-ed-program.header=Now tell us about {0}''s school or training program
activities-partner-add-ed-program.subtext=We will ask for program info and class schedule. You may be asked to submit their GPA at the end of the semester.

# parent-partner-info-bachelors
parent-partner-info-bachelors.title=Parent partner info bachelors
parent-partner-info-bachelors.header=Do they have a Bachelor's degree?

activities-partner-ed-program-method.description=This information helps us better understand {0}''s schedule.
activities-partner-ed-program-method.program.header=How are {0}''s classes taught?
activities-partner-ed-program-method.schedule.header=Are {0}''s classes taught on a schedule?
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/pdf-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ inputFields:
applicantSchoolPhoneNumber: APPLICANT_EDUCATION_SCHOOL_PHONE
applicantSchoolStartDate: APPLICANT_EDUCATION_SCHOOL_TERM_BEGIN_DATE
applicantSchoolEndDate: APPLICANT_EDUCATION_SCHOOL_TERM_END_DATE
applicantEducationHighestLevel: APPLICANT_EDUCATION_HIGHEST_LEVEL
parentEducation: APPLICANT_EDUCATION_TYPE
partnerEducation: PARTNER_EDUCATION_TYPE
parentGenderMale: APPLICANT_GENDER_MALE
Expand Down Expand Up @@ -102,6 +103,7 @@ inputFields:
partnerEducationScheduleSundayStart: PARTNER_EDUCATION_SCHEDULE_SUNDAY_START
partnerEducationScheduleSundayStartAmPm: PARTNER_EDUCATION_SCHEDULE_SUNDAY_START_AM_PM

partnerEducationHighestLevel: PARTNER_EDUCATION_HIGHEST_LEVEL
partnerEducationScheduleMondayEnd: PARTNER_EDUCATION_SCHEDULE_MONDAY_END
partnerEducationScheduleMondayEndAmPm: PARTNER_EDUCATION_SCHEDULE_MONDAY_END_AM_PM
partnerEducationScheduleTuesdayEnd: PARTNER_EDUCATION_SCHEDULE_TUESDAY_END
Expand Down
37 changes: 37 additions & 0 deletions src/main/resources/templates/gcc/parent-info-bachelors.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html th:lang="${#locale.language}" xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/head :: head(title=#{parent-info-bachelors.title})}"></head>
<body>
<div class="page-wrapper">
<div th:replace="~{fragments/toolbar :: toolbar}"></div>
<section class="slab">
<div class="grid">
<div th:replace="~{fragments/goBack :: goBackLink}"></div>
<main id="content" role="main" class="form-card spacing-above-35">
<th:block th:replace="~{fragments/gcc-icons :: mortarboard}"></th:block>
<th:block
th:replace="~{fragments/cardHeader :: cardHeader(
header=#{parent-info-bachelors.header})}"/>
<th:block
th:replace="~{fragments/form :: form(action=${formAction}, content=~{::formContent})}">
<th:block th:ref="formContent">
<div class="form-card__footer">
<th:block th:replace="~{fragments/inputs/yesOrNo :: yesOrNo(
inputName='applicantHasBachelorsDegree',
ariaDescribe='header')}"/>
<div class="spacing-above-60">
<button name="applicantHasBachelorsDegree" type="submit" value="skip"
id="applicantHasBachelorsDegree-skip"
class="button--link" th:text="#{general.skip}">
</button>
</div>
</div>
</th:block>
</th:block>
</main>
</div>
</section>
</div>
<th:block th:replace="~{fragments/footer :: footer}"/>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html th:lang="${#locale.language}" xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/head :: head(title=#{parent-partner-info-bachelors.title})}"></head>
<body>
<div class="page-wrapper">
<div th:replace="~{fragments/toolbar :: toolbar}"></div>
<section class="slab">
<div class="grid">
<div th:replace="~{fragments/goBack :: goBackLink}"></div>
<main id="content" role="main" class="form-card spacing-above-35">
<th:block th:replace="~{fragments/gcc-icons :: mortarboard}"></th:block>
<th:block
th:replace="~{fragments/cardHeader :: cardHeader(
header=#{parent-partner-info-bachelors.header})}"/>
<th:block
th:replace="~{fragments/form :: form(action=${formAction}, content=~{::formContent})}">
<th:block th:ref="formContent">
<div class="form-card__footer">
<th:block th:replace="~{fragments/inputs/yesOrNo :: yesOrNo(
inputName='partnerHasBachelorsDegree',
ariaDescribe='header')}"/>
<div class="spacing-above-60">
<button name="partnerHasBachelorsDegree" type="submit" value="skip"
id="partnerHasBachelorsDegree-skip"
class="button--link" th:text="#{general.skip}">
</button>
</div>
</div>
</th:block>
</th:block>
</main>
</div>
</section>
</div>
<th:block th:replace="~{fragments/footer :: footer}"/>
</body>
</html>
22 changes: 22 additions & 0 deletions src/test/java/org/ilgcc/app/journeys/ActivitiesJourneyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ void ParentOnlyWithJobAndWorkTest() {
assertThat(testPage.getHeader()).isEqualTo(getEnMessageWithParams("activities-add-ed-program.header", new Object[]{"parent first"}));
testPage.clickContinue();

//parent-info-bachelors
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("parent-info-bachelors.title"));
testPage.clickElementById("applicantHasBachelorsDegree-skip");

//activities-ed-program-type
assertThat(testPage.getElementText("educationType-highSchoolOrGed-label")).isEqualTo(getEnMessage("activities-ed-program-type.highSchool"));
testPage.clickElementById("educationType-highSchoolOrGed-label");
Expand Down Expand Up @@ -225,6 +229,10 @@ void ParentOnlyWithSchoolOnlyTest() {
assertThat(testPage.getHeader()).isEqualTo(getEnMessageWithParams("activities-add-ed-program.header", new Object[]{"parent first"}));
testPage.clickContinue();

//parent-info-bachelors
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("parent-info-bachelors.title"));
testPage.clickElementById("applicantHasBachelorsDegree-skip");

//activities-ed-program-type
assertThat(testPage.getElementText("educationType-highSchoolOrGed-label")).isEqualTo(getEnMessage("activities-ed-program-type.highSchool"));
testPage.clickElementById("educationType-highSchoolOrGed-label");
Expand Down Expand Up @@ -413,6 +421,10 @@ void ParentAndPartnerWithJobAndWorkTest() {
assertThat(testPage.getHeader()).isEqualTo(getEnMessageWithParams("activities-add-ed-program.header", new Object[]{"parent first"}));
testPage.clickContinue();

//parent-info-bachelors
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("parent-info-bachelors.title"));
testPage.clickElementById("applicantHasBachelorsDegree-skip");

//activities-ed-program-type
assertThat(testPage.getElementText("educationType-highSchoolOrGed-label")).isEqualTo(getEnMessage("activities-ed-program-type.highSchool"));
testPage.clickElementById("educationType-highSchoolOrGed-label");
Expand Down Expand Up @@ -523,6 +535,11 @@ void ParentAndPartnerWithJobAndWorkTest() {
//activities-partner-add-ed-program
assertThat(testPage.getHeader()).isEqualTo(getEnMessageWithParams("activities-partner-add-ed-program.header", new Object[]{"partner"}));
testPage.clickContinue();

//parent-partner-info-bachelors
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("parent-partner-info-bachelors.title"));
testPage.clickElementById("partnerHasBachelorsDegree-skip");

testPage.clickElementById("partnerEducationType-fourYearCollege-label");
assertThat(testPage.getHeader()).isEqualTo(getRequiredEnMessageWithParams("activities-partner-ed-program-type.header", new Object[]{"partner"}));
testPage.clickContinue();
Expand Down Expand Up @@ -575,6 +592,11 @@ void ParentAndPartnerWithPartnerSchoolOnlyTest() {
// Note that currently, we are skipping the parent partner job questions
assertThat(testPage.getHeader()).isEqualTo(getEnMessageWithParams("activities-partner-add-ed-program.header", new Object[]{"partner"}));
testPage.clickContinue();

//parent-partner-info-bachelors
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("parent-partner-info-bachelors.title"));
testPage.clickElementById("partnerHasBachelorsDegree-skip");

testPage.clickElementById("partnerEducationType-fourYearCollege-label");
assertThat(testPage.getHeader()).isEqualTo(getRequiredEnMessageWithParams("activities-partner-ed-program-type.header", new Object[]{"partner"}));
testPage.clickContinue();
Expand Down
9 changes: 9 additions & 0 deletions src/test/java/org/ilgcc/app/journeys/GccFlowJourneyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ void fullGccFlow() throws IOException {
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("activities-ed-program.title"));
testPage.clickContinue();

//parent-info-bachelors
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("parent-info-bachelors.title"));
testPage.clickYes();

//activities-ed-program-type
assertThat(testPage.getElementText("educationType-highSchoolOrGed-label")).isEqualTo(getEnMessage("activities-ed-program-type.highSchool"));
testPage.clickElementById("educationType-highSchoolOrGed-label");
Expand Down Expand Up @@ -451,6 +455,11 @@ void fullGccFlow() throws IOException {
// activities-partner-ed
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("activities-ed-program.title"));
testPage.clickContinue();

//parent-partner-info-bachelors
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("parent-partner-info-bachelors.title"));
testPage.clickElementById("partnerHasBachelorsDegree-skip");

assertThat(testPage.getTitle()).isEqualTo(getEnMessage("activities-ed-program.title"));
testPage.clickElementById("partnerEducationType-twoYearCollege-label");
testPage.clickContinue();
Expand Down
21 changes: 21 additions & 0 deletions src/test/java/org/ilgcc/app/pdf/ParentPartnerPreparerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,25 @@ public void shouldPreparePrimaryEducationTypeCheckboxFieldWhenSelected(){
assertThat(result.get("partnerEducation")).isEqualTo(new SingleField("partnerEducation", "PARTNER_EDUCATION_TYPE_INTERNSHIP", null));
}

@Test
public void shouldNotMapBAToHighestEducationIfQuestionIsSkipped(){
submission = new SubmissionTestBuilder()
.withParentDetails()
.build();

Map<String, SubmissionField> result = preparer.prepareSubmissionFields(submission, null);
assertThat(result.get("partnerEducationHighestLevel")).isNull();
}

@Test
public void shouldMapBAToHighestEducationIfSelected(){
submission = new SubmissionTestBuilder()
.withParentDetails()
.with("partnerHasBachelorsDegree", "true")
.build();

Map<String, SubmissionField> result = preparer.prepareSubmissionFields(submission, null);
assertThat(result.get("partnerEducationHighestLevel")).isEqualTo(new SingleField("partnerEducationHighestLevel", "BA degree", null));
}

}
20 changes: 20 additions & 0 deletions src/test/java/org/ilgcc/app/pdf/ParentPreparerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

import formflow.library.data.Submission;
import formflow.library.data.Submission.SubmissionBuilder;
import formflow.library.pdf.SingleField;
import formflow.library.pdf.SubmissionField;
import java.util.List;
Expand Down Expand Up @@ -194,7 +195,26 @@ public void shouldNotMapAnyFieldsIfClientSelectsPreferNotToAnswerToGenderQuestio
Map<String, SubmissionField> result = preparer.prepareSubmissionFields(submission, null);
assertThat(result.get("parentGenderMale")).isNotEqualTo(new SingleField("parentGenderMale", "Yes", null));
assertThat(result.get("parentGenderTNB")).isNotEqualTo(new SingleField("parentGenderTNB", "Nonbinary", null));
}

@Test
public void shouldNotMapBAToHighestEducationIfQuestionIsSkipped(){
submission = new SubmissionTestBuilder()
.withParentDetails()
.build();

Map<String, SubmissionField> result = preparer.prepareSubmissionFields(submission, null);
assertThat(result.get("applicantEducationHighestLevel")).isNull();
}

@Test
public void shouldMapBAToHighestEducationIfSelected(){
submission = new SubmissionTestBuilder()
.withParentDetails()
.with("applicantHasBachelorsDegree", "true")
.build();

Map<String, SubmissionField> result = preparer.prepareSubmissionFields(submission, null);
assertThat(result.get("applicantEducationHighestLevel")).isEqualTo(new SingleField("applicantEducationHighestLevel", "BA degree", null));
}
}
Binary file modified src/test/resources/output/test_filled_ccap.pdf
Binary file not shown.

0 comments on commit 6e0c73c

Please sign in to comment.