Browse Source

fix: rollup functions

pull/8900/head
Raju Udava 5 months ago
parent
commit
5c52970bd8
  1. 6
      packages/nc-gui/components/virtual-cell/Rollup.vue
  2. 14
      packages/nocodb-sdk/src/lib/helperFunctions.ts

6
packages/nc-gui/components/virtual-cell/Rollup.vue

@ -41,7 +41,11 @@ const childColumn = computed(() => {
<template> <template>
<div class="nc-cell-field" @dblclick="activateShowEditNonEditableFieldWarning"> <div class="nc-cell-field" @dblclick="activateShowEditNonEditableFieldWarning">
<div v-if="['count', 'avg', 'sum', 'countDistinct', 'sumDistinct', 'avgDistinct'].includes(colOptions.rollup_function)"> <div
v-if="
['count', 'avg', 'sum', 'min', 'max', 'countDistinct', 'sumDistinct', 'avgDistinct'].includes(colOptions.rollup_function)
"
>
{{ value }} {{ value }}
</div> </div>
<LazySmartsheetCell v-else v-model="value" :column="childColumn" :edit-enabled="false" :read-only="true" /> <LazySmartsheetCell v-else v-model="value" :column="childColumn" :edit-enabled="false" :read-only="true" />

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

@ -59,7 +59,10 @@ const stringifyRolesObj = (roles?: RolesObj | null): string => {
}; };
const getAvailableRollupForUiType = (type: string) => { const getAvailableRollupForUiType = (type: string) => {
if (isNumericCol(type as UITypes)) { if ([UITypes.Year].includes(type as UITypes)) {
return ['count', 'min', 'max', 'countDistinct'];
} else if (isNumericCol(type as UITypes)) {
// Number, Currency, Percent, Duration, Rating, Decimal
return [ return [
'sum', 'sum',
'count', 'count',
@ -87,13 +90,18 @@ const getAvailableRollupForUiType = (type: string) => {
UITypes.Email, UITypes.Email,
UITypes.PhoneNumber, UITypes.PhoneNumber,
UITypes.URL, UITypes.URL,
UITypes.Checkbox,
UITypes.JSON, UITypes.JSON,
].includes(type as UITypes) ].includes(type as UITypes)
) { ) {
return ['count']; return ['count', 'countDistinct'];
} else if ([UITypes.Checkbox].includes(type as UITypes)) {
return ['count', 'sum'];
} else if ([UITypes.Attachment].includes(type as UITypes)) { } else if ([UITypes.Attachment].includes(type as UITypes)) {
return []; return [];
} else if (
[UITypes.SingleSelect, UITypes.MultiSelect].includes(type as UITypes)
) {
return ['count', 'countDistinct'];
} else { } else {
return [ return [
'sum', 'sum',

Loading…
Cancel
Save