diff --git a/backend/src/main/java/de/secretj12/turnierplaner/db/entities/Player.java b/backend/src/main/java/de/secretj12/turnierplaner/db/entities/Player.java index 62a2022c..c11a1735 100644 --- a/backend/src/main/java/de/secretj12/turnierplaner/db/entities/Player.java +++ b/backend/src/main/java/de/secretj12/turnierplaner/db/entities/Player.java @@ -18,8 +18,8 @@ AND (p.birthday <= :minAge OR :ignoreMinAge = true) AND (p.birthday >= :maxAge OR :ignoreMaxAge = true) AND (lower(p.firstName) like CONCAT('%', lower(:search), '%') - OR lower(p.lastName) = CONCAT('%', lower(:search), '%') - OR lower(CONCAT(p.firstName, ' ', p.lastName)) like CONCAT('%', lower(:search), '%')) + OR lower(p.lastName) = CONCAT('%', (lower(:search)), '%') + OR lower(CONCAT(p.firstName, ' ', p.lastName)) like CONCAT('%', :search, '%')) ORDER BY CASE WHEN lower(p.firstName) like CONCAT(lower(:search), '%') THEN 0 WHEN lower(p.lastName) like CONCAT(lower(:search), '%') THEN 1 @@ -34,9 +34,9 @@ WHEN lower(p.lastName) like CONCAT(lower(:search), '%') THEN 1 AND (p.sex = :sex OR :ignoreSex = true) AND (p.birthday <= :minAge OR :ignoreMinAge = true) AND (p.birthday >= :maxAge OR :ignoreMaxAge = true) - AND (lower(p.firstName) like CONCAT('%', lower(:search), '%') - OR lower(p.lastName) = CONCAT('%', lower(:search), '%') - OR lower(CONCAT(p.firstName, ' ', p.lastName)) like CONCAT('%', lower(:search), '%'))""" + AND ((p.firstName) like CONCAT('%', :search, '%') + OR (p.lastName) = CONCAT('%', :search, '%') + OR (CONCAT(p.firstName, ' ', p.lastName)) like CONCAT('%', :search, '%'))""" ), @NamedQuery(name = "adminUnverified", query = """ diff --git a/backend/src/main/java/de/secretj12/turnierplaner/resources/PlayerResource.java b/backend/src/main/java/de/secretj12/turnierplaner/resources/PlayerResource.java index df497c23..d7e0fec2 100644 --- a/backend/src/main/java/de/secretj12/turnierplaner/resources/PlayerResource.java +++ b/backend/src/main/java/de/secretj12/turnierplaner/resources/PlayerResource.java @@ -53,6 +53,7 @@ public class PlayerResource { @ConfigProperty(name = "turnierplaner.registration.expire") public int expire; + // expects search string as lower case! @GET @Path("/compFind/{tourId}/{compId}/") @Produces(MediaType.APPLICATION_JSON) diff --git a/frontend/app/src/backend/competition.ts b/frontend/app/src/backend/competition.ts index a60ea1bf..a49b2b09 100644 --- a/frontend/app/src/backend/competition.ts +++ b/frontend/app/src/backend/competition.ts @@ -192,7 +192,7 @@ export function useSignUpSingle( ) { return useMutation({ mutationFn: async (data: { - player: Ref + player: Ref playerB: boolean }) => { if (!data.player.value) { @@ -202,7 +202,7 @@ export function useSignUpSingle( detail: t("ViewSignUp.selectPlayerFirst"), life: 3000, }) - return + throw new Error("No player selected") } const form: TeamServer = { @@ -229,8 +229,8 @@ export function useSignUpDoubleTog( ) { return useMutation({ mutationFn: async (data: { - playerA: Ref - playerB: Ref + playerA: Ref + playerB: Ref }) => { if (!data.playerA.value || !data.playerB.value) { toast.add({ @@ -239,7 +239,7 @@ export function useSignUpDoubleTog( detail: t("ViewSignUp.selectPlayerFirst"), life: 3000, }) - return + throw new Error("No player selected") } const form = { diff --git a/frontend/app/src/backend/player.ts b/frontend/app/src/backend/player.ts index 3a447ba9..c10c9e15 100644 --- a/frontend/app/src/backend/player.ts +++ b/frontend/app/src/backend/player.ts @@ -33,10 +33,13 @@ export function findCompPlayers( queryFn: async () => { return axios .get( - `/player/compFind/${route.params.tourId}/${route.params.compId}?search=${search.value.toLowerCase()}` + - `playerB=${playerB}`, + `/player/compFind/${route.params.tourId}/${route.params.compId}`, + { params: { search: search.value.toLowerCase(), playerB: playerB } }, ) - .then((result) => result.data.map(playerServerToClient)) + .then((result) => { + console.log(result.data.map(playerServerToClient)) + return result.data.map(playerServerToClient) + }) .catch((error) => { toast.add({ severity: "error", diff --git a/frontend/app/src/components/views/competition/signup/ViewConditions.vue b/frontend/app/src/components/views/competition/signup/ViewConditions.vue index 6cdf3629..a96cd42f 100644 --- a/frontend/app/src/components/views/competition/signup/ViewConditions.vue +++ b/frontend/app/src/components/views/competition/signup/ViewConditions.vue @@ -4,7 +4,7 @@ v-if="player.sex !== Sex.ANY" class="w-min font-medium" rounded - :value="t('CompetitionSettings.' + player.sex.toLowerCase())" + :value="t('general.' + player.sex.toLowerCase())" />