Merge pull request #10591 from Budibase/fix/automation-filtering
Fix automation filtering on number fields
This commit is contained in:
commit
15ff635c6e
|
@ -13,6 +13,7 @@ import {
|
||||||
SearchFilters,
|
SearchFilters,
|
||||||
Table,
|
Table,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
|
import { db as dbCore } from "@budibase/backend-core"
|
||||||
|
|
||||||
enum SortOrder {
|
enum SortOrder {
|
||||||
ASCENDING = "ascending",
|
ASCENDING = "ascending",
|
||||||
|
@ -117,7 +118,11 @@ function typeCoercion(filters: SearchFilters, table: Table) {
|
||||||
const searchParam = filters[key]
|
const searchParam = filters[key]
|
||||||
if (typeof searchParam === "object") {
|
if (typeof searchParam === "object") {
|
||||||
for (let [property, value] of Object.entries(searchParam)) {
|
for (let [property, value] of Object.entries(searchParam)) {
|
||||||
const column = table.schema[property]
|
// We need to strip numerical prefixes here, so that we can look up
|
||||||
|
// the correct field name in the schema
|
||||||
|
const columnName = dbCore.removeKeyNumbering(property)
|
||||||
|
const column = table.schema[columnName]
|
||||||
|
|
||||||
// convert string inputs
|
// convert string inputs
|
||||||
if (!column || typeof value !== "string") {
|
if (!column || typeof value !== "string") {
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue