diff --git a/packages/nocodb/tests/unit/rest/tests/filter.test.ts b/packages/nocodb/tests/unit/rest/tests/filter.test.ts index 3c83a22d04..1a4267a743 100644 --- a/packages/nocodb/tests/unit/rest/tests/filter.test.ts +++ b/packages/nocodb/tests/unit/rest/tests/filter.test.ts @@ -96,19 +96,25 @@ async function retrieveRecordsAndValidate( ); break; case 'lt': - expectedRecords = unfilteredRecords.filter( - (record) => - (toFloat ? parseFloat(record[title]) : record[title]) < - (toFloat ? parseFloat(filter.value) : filter.value) && - record[title] !== null + expectedRecords = unfilteredRecords.filter((record) => + title === 'Rating' + ? (toFloat ? parseFloat(record[title]) : record[title]) < + (toFloat ? parseFloat(filter.value) : filter.value) || + record[title] === null + : (toFloat ? parseFloat(record[title]) : record[title]) < + (toFloat ? parseFloat(filter.value) : filter.value) && + record[title] !== null ); break; case 'lte': - expectedRecords = unfilteredRecords.filter( - (record) => - (toFloat ? parseFloat(record[title]) : record[title]) <= - (toFloat ? parseFloat(filter.value) : filter.value) && - record[title] !== null + expectedRecords = unfilteredRecords.filter((record) => + title === 'Rating' + ? (toFloat ? parseFloat(record[title]) : record[title]) <= + (toFloat ? parseFloat(filter.value) : filter.value) || + record[title] === null + : (toFloat ? parseFloat(record[title]) : record[title]) <= + (toFloat ? parseFloat(filter.value) : filter.value) && + record[title] !== null ); break; case 'anyof': diff --git a/tests/playwright/tests/filters.spec.ts b/tests/playwright/tests/filters.spec.ts index 76ed73105e..4b5bc8b9a1 100644 --- a/tests/playwright/tests/filters.spec.ts +++ b/tests/playwright/tests/filters.spec.ts @@ -144,13 +144,18 @@ test.describe('Filter Tests: Numerical', () => { { op: '<', value: isLikeString, - rowCount: records.list.filter(r => r[dataType] < parseFloat(isLikeStringDerived) && r[dataType] != null).length, + rowCount: + dataType === 'Rating' + ? records.list.filter(r => r[dataType] < parseFloat(isLikeStringDerived)).length + : records.list.filter(r => r[dataType] < parseFloat(isLikeStringDerived) && r[dataType] != null).length, }, { op: '<=', value: isLikeString, - rowCount: records.list.filter(r => r[dataType] <= parseFloat(isLikeStringDerived) && r[dataType] != null) - .length, + rowCount: + dataType === 'Rating' + ? records.list.filter(r => r[dataType] <= parseFloat(isLikeStringDerived)).length + : records.list.filter(r => r[dataType] <= parseFloat(isLikeStringDerived) && r[dataType] != null).length, }, ];