From c984055bb1c4e8b27e78923be6378014d3dba6d0 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Mon, 15 Jul 2024 15:25:29 +0000 Subject: [PATCH] fix: coderabbit suggestion --- .../nocodb-sdk/src/lib/helperFunctions.ts | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/packages/nocodb-sdk/src/lib/helperFunctions.ts b/packages/nocodb-sdk/src/lib/helperFunctions.ts index a9a5a393d2..8d61d19d62 100644 --- a/packages/nocodb-sdk/src/lib/helperFunctions.ts +++ b/packages/nocodb-sdk/src/lib/helperFunctions.ts @@ -61,7 +61,8 @@ const stringifyRolesObj = (roles?: RolesObj | null): string => { const getAvailableRollupForUiType = (type: string) => { if ([UITypes.Year].includes(type as UITypes)) { return ['count', 'min', 'max', 'countDistinct']; - } else if (isNumericCol(type as UITypes)) { + } + if (isNumericCol(type as UITypes)) { // Number, Currency, Percent, Duration, Rating, Decimal return [ 'sum', @@ -73,7 +74,8 @@ const getAvailableRollupForUiType = (type: string) => { 'sumDistinct', 'avgDistinct', ]; - } else if ( + } + if ( [ UITypes.Date, UITypes.DateTime, @@ -82,7 +84,8 @@ const getAvailableRollupForUiType = (type: string) => { ].includes(type as UITypes) ) { return ['count', 'min', 'max', 'countDistinct']; - } else if ( + } + if ( [ UITypes.SingleLineText, UITypes.LongText, @@ -94,26 +97,26 @@ const getAvailableRollupForUiType = (type: string) => { ].includes(type as UITypes) ) { return ['count', 'countDistinct']; - } else if ([UITypes.Checkbox].includes(type as UITypes)) { + } + if ([UITypes.Checkbox].includes(type as UITypes)) { return ['count', 'sum']; - } else if ([UITypes.Attachment].includes(type as UITypes)) { + } + if ([UITypes.Attachment].includes(type as UITypes)) { return []; - } else if ( - [UITypes.SingleSelect, UITypes.MultiSelect].includes(type as UITypes) - ) { + } + if ([UITypes.SingleSelect, UITypes.MultiSelect].includes(type as UITypes)) { return ['count', 'countDistinct']; - } else { - return [ - 'sum', - 'count', - 'min', - 'max', - 'avg', - 'countDistinct', - 'sumDistinct', - 'avgDistinct', - ]; } + return [ + 'sum', + 'count', + 'min', + 'max', + 'avg', + 'countDistinct', + 'sumDistinct', + 'avgDistinct', + ]; }; const getFileName = ({ name, count, ext }) =>