From ce48f7470fbe9f66d055b7940c2b08af55336dd7 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 23 Feb 2023 15:07:50 +0800 Subject: [PATCH] chore(nocodb): reorder lt, le, lte in conditionV2 --- .../db/sql-data-mapper/lib/sql/conditionV2.ts | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts index e659948d3e..dfe0d061e3 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts @@ -476,6 +476,27 @@ const parseConditionV2 = async ( } } break; + case 'lt': + const lt_op = customWhereClause ? '>' : '<'; + qb = qb.where(field, lt_op, val); + if (column.uidt === UITypes.Rating) { + // unset number is considered as NULL + if (lt_op === '<' && val > 0) { + qb = qb.orWhereNull(field); + } + } + break; + case 'le': + case 'lte': + const le_op = customWhereClause ? '>=' : '<='; + qb = qb.where(field, le_op, val); + if (column.uidt === UITypes.Rating) { + // unset number is considered as NULL + if (le_op === '<=' || (le_op === '>=' && val === 0)) { + qb = qb.orWhereNull(field); + } + } + break; case 'in': qb = qb.whereIn( field, @@ -512,27 +533,6 @@ const parseConditionV2 = async ( else if (filter.value === 'false') qb = qb.whereNot(customWhereClause || field, false); break; - case 'lt': - const lt_op = customWhereClause ? '>' : '<'; - qb = qb.where(field, lt_op, val); - if (column.uidt === UITypes.Rating) { - // unset number is considered as NULL - if (lt_op === '<' && val > 0) { - qb = qb.orWhereNull(field); - } - } - break; - case 'le': - case 'lte': - const le_op = customWhereClause ? '>=' : '<='; - qb = qb.where(field, le_op, val); - if (column.uidt === UITypes.Rating) { - // unset number is considered as NULL - if (le_op === '<=' || (le_op === '>=' && val === 0)) { - qb = qb.orWhereNull(field); - } - } - break; case 'empty': if (column.uidt === UITypes.Formula) { [field, val] = [val, field];