Skip to content

Commit

Permalink
Tidy Cas1SpaceSearchService
Browse files Browse the repository at this point in the history
Remove unneccessary private functions, inlining calls instead.
  • Loading branch information
davidatkinsuk committed Jan 2, 2025
1 parent de6172e commit bc9ec4b
Showing 1 changed file with 5 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ class Cas1SpaceSearchService(

val requiredCharacteristics = getRequiredCharacteristics(searchParameters.requirements)

return getCandidatePremises(
searchParameters.targetPostcodeDistrict,
requiredCharacteristics,
return spaceSearchRepository.findAllPremisesWithCharacteristicsByDistance(
targetPostcodeDistrict = searchParameters.targetPostcodeDistrict,
approvedPremisesType = requiredCharacteristics.apType,
isWomensPremises = application.isWomensApplication!!,
premisesCharacteristics = requiredCharacteristics.groupedCharacteristics.premisesCharacteristics,
roomCharacteristics = requiredCharacteristics.groupedCharacteristics.roomCharacteristics,
)
}

Expand All @@ -54,20 +56,6 @@ class Cas1SpaceSearchService(
)
}

private fun getCandidatePremises(
targetPostcodeDistrict: String,
requiredCharacteristics: RequiredCharacteristics,
isWomensPremises: Boolean,
): List<CandidatePremises> {
return spaceSearchRepository.findAllPremisesWithCharacteristicsByDistance(
targetPostcodeDistrict,
requiredCharacteristics.apType,
isWomensPremises,
requiredCharacteristics.groupedCharacteristics.premisesCharacteristics,
requiredCharacteristics.groupedCharacteristics.roomCharacteristics,
)
}

private fun CharacteristicEntity.isPremisesCharacteristic(): Boolean =
this.serviceMatches(ServiceName.approvedPremises.value) && this.modelMatches("premises")

Expand Down

0 comments on commit bc9ec4b

Please sign in to comment.