Skip to content

Commit

Permalink
Merge pull request #128 from Onlineberatung/develop
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
tkuzynow authored Feb 28, 2024
2 parents 8fcb833 + 73476ed commit 6ad6523
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public interface AgencyRepository extends JpaRepository<Agency, Long> {
String SELECT_WITH_TOPICS = "SELECT a.*, :tenantId FROM agency a "
+ "LEFT JOIN agency_postcode_range r ON a.id = r.agency_id "
+ "INNER JOIN agency_topic at ON a.id = at.agency_id "
+ "WHERE :postcode is NULL OR ((CAST(:postcode AS INT) BETWEEN CAST(SUBSTR(r.postcode_from, 1, :length) AS int) "
+ "AND CAST(SUBSTR(r.postcode_to, 1, :length) AS int))) " + "AND a.is_offline = false "
+ "WHERE (:postcode is NULL OR ((CAST(:postcode AS INT) BETWEEN CAST(SUBSTR(r.postcode_from, 1, :length) AS int) "
+ "AND CAST(SUBSTR(r.postcode_to, 1, :length) AS int)))) " + "AND a.is_offline = false "
+ "AND (:type is NULL OR a.consulting_type = :type) "
+ "AND at.topic_id = :topicId "
+ AND_WITH_BRACKET
Expand All @@ -33,8 +33,8 @@ public interface AgencyRepository extends JpaRepository<Agency, Long> {
String SELECT_WITHOUT_TOPICS = "SELECT a.*, :tenantId FROM agency a "
+ "LEFT JOIN agency_postcode_range r ON a.id = r.agency_id "
+ "WHERE "
+ ":postcode is NULL OR ((CAST(:postcode AS INT) BETWEEN CAST(SUBSTR(r.postcode_from, 1, :length) AS int) "
+ "AND CAST(SUBSTR(r.postcode_to, 1, :length) AS int))) " + "AND a.is_offline = false "
+ "(:postcode is NULL OR ((CAST(:postcode AS INT) BETWEEN CAST(SUBSTR(r.postcode_from, 1, :length) AS int) "
+ "AND CAST(SUBSTR(r.postcode_to, 1, :length) AS int)))) " + "AND a.is_offline = false "
+ "AND (:type is NULL OR a.consulting_type = :type) "
+ AND_WITH_BRACKET
+ " (:age IS NULL) OR (a.age_from <= :age)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void searchWithoutTopic_Should_findAgencyByOnlyConsultingTypeSkippingPostCodeFil
// given, when
var agencyList = agencyRepository.searchWithoutTopic(null, 5, 0, null, null, null, 1L);
// then
assertThat(agencyList).hasSize(1138);
assertThat(agencyList).hasSize(104);
}


Expand All @@ -79,7 +79,7 @@ void searchWithTopic_Should_findAgencyConsultingTypeAndTopicIdSkippingPostCode()
// given, when
var agencyList = agencyRepository.searchWithTopic(null, 5, 0, 1, null, null, null, 1L);
// then
assertThat(agencyList).hasSize(4);
assertThat(agencyList).hasSize(2);
}

@Test
Expand Down

0 comments on commit 6ad6523

Please sign in to comment.