Browse Source

fix: coderabbit suggestion

pull/8900/head
Raju Udava 5 months ago
parent
commit
c984055bb1
  1. 41
      packages/nocodb-sdk/src/lib/helperFunctions.ts

41
packages/nocodb-sdk/src/lib/helperFunctions.ts

@ -61,7 +61,8 @@ const stringifyRolesObj = (roles?: RolesObj | null): string => {
const getAvailableRollupForUiType = (type: string) => { const getAvailableRollupForUiType = (type: string) => {
if ([UITypes.Year].includes(type as UITypes)) { if ([UITypes.Year].includes(type as UITypes)) {
return ['count', 'min', 'max', 'countDistinct']; return ['count', 'min', 'max', 'countDistinct'];
} else if (isNumericCol(type as UITypes)) { }
if (isNumericCol(type as UITypes)) {
// Number, Currency, Percent, Duration, Rating, Decimal // Number, Currency, Percent, Duration, Rating, Decimal
return [ return [
'sum', 'sum',
@ -73,7 +74,8 @@ const getAvailableRollupForUiType = (type: string) => {
'sumDistinct', 'sumDistinct',
'avgDistinct', 'avgDistinct',
]; ];
} else if ( }
if (
[ [
UITypes.Date, UITypes.Date,
UITypes.DateTime, UITypes.DateTime,
@ -82,7 +84,8 @@ const getAvailableRollupForUiType = (type: string) => {
].includes(type as UITypes) ].includes(type as UITypes)
) { ) {
return ['count', 'min', 'max', 'countDistinct']; return ['count', 'min', 'max', 'countDistinct'];
} else if ( }
if (
[ [
UITypes.SingleLineText, UITypes.SingleLineText,
UITypes.LongText, UITypes.LongText,
@ -94,26 +97,26 @@ const getAvailableRollupForUiType = (type: string) => {
].includes(type as UITypes) ].includes(type as UITypes)
) { ) {
return ['count', 'countDistinct']; return ['count', 'countDistinct'];
} else if ([UITypes.Checkbox].includes(type as UITypes)) { }
if ([UITypes.Checkbox].includes(type as UITypes)) {
return ['count', 'sum']; return ['count', 'sum'];
} else if ([UITypes.Attachment].includes(type as UITypes)) { }
if ([UITypes.Attachment].includes(type as UITypes)) {
return []; return [];
} else if ( }
[UITypes.SingleSelect, UITypes.MultiSelect].includes(type as UITypes) if ([UITypes.SingleSelect, UITypes.MultiSelect].includes(type as UITypes)) {
) {
return ['count', 'countDistinct']; 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 }) => const getFileName = ({ name, count, ext }) =>

Loading…
Cancel
Save