Browse Source

chore(nocodb): reorder lt, le, lte in conditionV2

pull/5185/head
Wing-Kam Wong 2 years ago
parent
commit
ce48f7470f
  1. 42
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts

42
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts

@ -476,6 +476,27 @@ const parseConditionV2 = async (
} }
} }
break; 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': case 'in':
qb = qb.whereIn( qb = qb.whereIn(
field, field,
@ -512,27 +533,6 @@ const parseConditionV2 = async (
else if (filter.value === 'false') else if (filter.value === 'false')
qb = qb.whereNot(customWhereClause || field, false); qb = qb.whereNot(customWhereClause || field, false);
break; 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': case 'empty':
if (column.uidt === UITypes.Formula) { if (column.uidt === UITypes.Formula) {
[field, val] = [val, field]; [field, val] = [val, field];

Loading…
Cancel
Save