File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
adminforth/dataConnectors Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -233,10 +233,14 @@ export default class AdminForthBaseConnector implements IAdminForthDataSourceCon
233233 // Float
234234 if ( field . type === AdminForthDataTypes . FLOAT ) {
235235 if ( value === "" || value === null ) return this . setFieldValue ( field , null ) ;
236- const number =
237- typeof value === "number"
238- ? value
239- : ( typeof value === "object" && value !== null ? ( value as any ) . valueOf ( ) : NaN ) ;
236+ let number : any ;
237+ if ( typeof value === "number" ) {
238+ number = value ;
239+ } else if ( typeof value === "object" && value !== null ) {
240+ number = ( value as any ) . valueOf ( ) ;
241+ } else {
242+ number = NaN ;
243+ }
240244
241245 if ( typeof number !== "number" || ! Number . isFinite ( number ) ) {
242246 throw new Error (
Original file line number Diff line number Diff line change @@ -266,7 +266,7 @@ class MongoConnector extends AdminForthBaseConnector implements IAdminForthDataS
266266 return { $expr : { [ mongoExprOp ] : [ left , right ] } } ;
267267 }
268268 const column = resource . dataSourceColumns . find ( ( col ) => col . name === ( filter as IAdminForthSingleFilter ) . field ) ;
269- if ( column && [ AdminForthDataTypes . INTEGER , AdminForthDataTypes . DECIMAL , AdminForthDataTypes . FLOAT ] . includes ( column . type ) ) {
269+ if ( [ AdminForthDataTypes . INTEGER , AdminForthDataTypes . DECIMAL , AdminForthDataTypes . FLOAT ] . includes ( column . type ) ) {
270270 return { [ ( filter as IAdminForthSingleFilter ) . field ] : this . OperatorsMap [ filter . operator ] ( + ( filter as IAdminForthSingleFilter ) . value ) } ;
271271 }
272272 return { [ ( filter as IAdminForthSingleFilter ) . field ] : this . OperatorsMap [ filter . operator ] ( ( filter as IAdminForthSingleFilter ) . value ) } ;
You can’t perform that action at this time.
0 commit comments