Skip to content

Commit

Permalink
TMI2-628 - Adds local authority enum for applicant org type (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiramarstonTCO authored Feb 16, 2024
1 parent a56e877 commit a924329
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class MandatoryQuestionConstants {
GrantMandatoryQuestionOrgType.OTHER.toString(),
GrantMandatoryQuestionOrgType.CHARITY.toString(),
GrantMandatoryQuestionOrgType.INDIVIDUAL.toString(),
GrantMandatoryQuestionOrgType.LOCAL_AUTHORITY.toString(),
};

public static final String ORGANISATION_ADDRESS_TITLE = "Enter your organisations address";
Expand Down Expand Up @@ -64,7 +65,7 @@ public class MandatoryQuestionConstants {
public static final String APPLICANT_FUNDING_LOCATION_TITLE = "Where will this funding be spent?";
public static final String APPLICANT_FUNDING_LOCATION_HINT_TEXT = "Select the location where the grant funding will be spent. You can choose more than one, if it is being spent in more than one location.\n\nSelect all that apply:";
public static final String APPLICANT_FUNDING_LOCATION_ADMIN_SUMMARY = "where the funding will be spent";
public static final String[] APPLICANT_FUNDING_LOCATION_OPTIONS = new String[]{
public static final String[] APPLICANT_FUNDING_LOCATION_OPTIONS = new String[] {
"North East England",
"North West England",
"South East England",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public enum GrantApplicantOrganisationType {
UNREGISTERED_CHARITY("Unregistered charity"),
CHARITY("Charity"),
INDIVIDUAL("I am applying as an individual"),
LOCAL_AUTHORITY("Local authority"),
OTHER("Other");

private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public enum GrantMandatoryQuestionOrgType {
UNREGISTERED_CHARITY("Unregistered charity"),
CHARITY("Charity"),
INDIVIDUAL("I am applying as an individual"),
LOCAL_AUTHORITY("Local authority"),
OTHER("Other");

private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public ResponseEntity<String> submitApplication(@RequestBody SubmitApplicationDt

if (scheme.getVersion() > 1) {
final GrantMandatoryQuestions mandatoryQuestions = mandatoryQuestionService.getGrantMandatoryQuestionBySubmissionIdAndApplicantSub(submission.getId(), grantApplicant.getUserId());
final boolean shouldSendToSpotlight = !isOrganisationIndividualOrOther(mandatoryQuestions);
final boolean shouldSendToSpotlight = !isOrganisationIndividualOrOtherOrLocalAuthority(mandatoryQuestions);

if (shouldSendToSpotlight) {
spotlightService.createSpotlightCheck(mandatoryQuestions, scheme);
Expand All @@ -236,9 +236,10 @@ public ResponseEntity<String> submitApplication(@RequestBody SubmitApplicationDt
return ResponseEntity.ok("Submitted");
}

private boolean isOrganisationIndividualOrOther(GrantMandatoryQuestions mandatoryQuestions) {
private boolean isOrganisationIndividualOrOtherOrLocalAuthority(GrantMandatoryQuestions mandatoryQuestions) {
return mandatoryQuestions.getOrgType().equals(GrantMandatoryQuestionOrgType.INDIVIDUAL) ||
mandatoryQuestions.getOrgType().equals(GrantMandatoryQuestionOrgType.OTHER);
mandatoryQuestions.getOrgType().equals(GrantMandatoryQuestionOrgType.OTHER) ||
mandatoryQuestions.getOrgType().equals(GrantMandatoryQuestionOrgType.LOCAL_AUTHORITY);
}

@PostMapping("/createSubmission/{applicationId}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ void submitApplication_isSuccessfulAndReturnsExpectedResponse_ForV2Schemes() {
}

@ParameterizedTest
@EnumSource(value = GrantMandatoryQuestionOrgType.class, names = {"INDIVIDUAL", "OTHER"})
@EnumSource(value = GrantMandatoryQuestionOrgType.class, names = {"INDIVIDUAL", "OTHER", "LOCAL_AUTHORITY"})
void submitApplication_DoesNotCreateSpotlightCheck_ForIndividualsOrOther_ForV2Schemes(GrantMandatoryQuestionOrgType orgType) {

// set up the V2 scheme
Expand Down

0 comments on commit a924329

Please sign in to comment.