Trim search queries - 1.138

Closes #156
This commit is contained in:
Brandon Presley 2023-06-13 14:10:51 +12:00
parent 90db607190
commit 9c9a5fdd63
6 changed files with 11 additions and 8 deletions

View File

@ -30,7 +30,7 @@ export default function BestList() {
.createQueryBuilder() .createQueryBuilder()
.select() .select()
.addSelect('MAX(weight)', 'weight') .addSelect('MAX(weight)', 'weight')
.where('name LIKE :name', {name: `%${value}%`}) .where('name LIKE :name', {name: `%${value.trim()}%`})
.andWhere('NOT hidden') .andWhere('NOT hidden')
.groupBy('name') .groupBy('name')
.getMany() .getMany()

View File

@ -24,7 +24,10 @@ export default function PlanList() {
const refresh = useCallback(async (value: string) => { const refresh = useCallback(async (value: string) => {
planRepo planRepo
.find({ .find({
where: [{days: Like(`%${value}%`)}, {workouts: Like(`%${value}%`)}], where: [
{days: Like(`%${value.trim()}%`)},
{workouts: Like(`%${value.trim()}%`)},
],
}) })
.then(setPlans) .then(setPlans)
}, []) }, [])

View File

@ -29,7 +29,7 @@ export default function SetList() {
const refresh = useCallback(async (value: string) => { const refresh = useCallback(async (value: string) => {
const newSets = await setRepo.find({ const newSets = await setRepo.find({
where: {name: Like(`%${value}%`), hidden: 0 as any}, where: {name: Like(`%${value.trim()}%`), hidden: 0 as any},
take: limit, take: limit,
skip: 0, skip: 0,
order: {created: 'DESC'}, order: {created: 'DESC'},

View File

@ -29,7 +29,7 @@ export default function WorkoutList() {
const newWorkouts = await setRepo const newWorkouts = await setRepo
.createQueryBuilder() .createQueryBuilder()
.select() .select()
.where('name LIKE :name', {name: `%${value}%`}) .where('name LIKE :name', {name: `%${value.trim()}%`})
.groupBy('name') .groupBy('name')
.orderBy('name') .orderBy('name')
.limit(limit) .limit(limit)
@ -71,7 +71,7 @@ export default function WorkoutList() {
const newWorkouts = await setRepo const newWorkouts = await setRepo
.createQueryBuilder() .createQueryBuilder()
.select() .select()
.where('name LIKE :name', {name: `%${term}%`}) .where('name LIKE :name', {name: `%${term.trim()}%`})
.groupBy('name') .groupBy('name')
.orderBy('name') .orderBy('name')
.limit(limit) .limit(limit)

View File

@ -41,8 +41,8 @@ android {
missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60" missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60"
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 36163 versionCode 36164
versionName "1.137" versionName "1.138"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
if (isNewArchitectureEnabled()) { if (isNewArchitectureEnabled()) {

View File

@ -1,6 +1,6 @@
{ {
"name": "massive", "name": "massive",
"version": "1.137", "version": "1.138",
"private": true, "private": true,
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"scripts": { "scripts": {