Fix ages in filters

This commit is contained in:
MartinBraquet
2025-09-16 22:09:43 +02:00
parent 7b2b9855f9
commit 41a606f5c1
2 changed files with 4 additions and 4 deletions

View File

@@ -33,7 +33,7 @@ export function formatFilters(filters: Partial<FilterFields>, location: location
let ageMin: number | undefined | null = filters.pref_age_min
if (ageMin == 18) ageMin = undefined
let ageMax = filters.pref_age_max;
if (ageMax == 99 || ageMax == 100) ageMax = undefined
if (ageMax == 100) ageMax = undefined
if (ageMin || ageMax) {
let text: string = 'Age: '
if (ageMin) text = `${text}${ageMin}`

View File

@@ -25,7 +25,7 @@ export const useFilters = (you: Lover | undefined) => {
}
if ('pref_age_max' in updatedState && updatedState.pref_age_max !== undefined) {
if (updatedState.pref_age_max != null && updatedState.pref_age_max >= 99) {
if (updatedState.pref_age_max != null && updatedState.pref_age_max >= 100) {
updatedState.pref_age_max = undefined
}
}
@@ -69,8 +69,8 @@ export const useFilters = (you: Lover | undefined) => {
const yourFilters: Partial<FilterFields> = {
genders: you?.pref_gender?.length ? you.pref_gender : undefined,
pref_gender: you?.gender?.length ? [you.gender] : undefined,
pref_age_max: you?.pref_age_max,
pref_age_min: you?.pref_age_min,
pref_age_max: (you?.pref_age_max ?? MAX_AGE) < 100 ? you?.pref_age_max : undefined,
pref_age_min: (you?.pref_age_min ?? MIN_AGE) > 18 ? you?.pref_age_min : undefined,
pref_relation_styles: you?.pref_relation_styles.length ? you.pref_relation_styles : undefined,
wants_kids_strength: wantsKidsDatabaseToWantsKidsFilter(
(you?.wants_kids_strength ?? 2) as wantsKidsDatabase