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

TMI2-628 - Add local authority to applicant organisation and MQs #118

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading