Browse Source

fix: rollup functions

pull/8900/head
Raju Udava 4 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>
<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 }}
</div>
<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) => {
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 [
'sum',
'count',
@ -87,13 +90,18 @@ const getAvailableRollupForUiType = (type: string) => {
UITypes.Email,
UITypes.PhoneNumber,
UITypes.URL,
UITypes.Checkbox,
UITypes.JSON,
].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)) {
return [];
} else if (
[UITypes.SingleSelect, UITypes.MultiSelect].includes(type as UITypes)
) {
return ['count', 'countDistinct'];
} else {
return [
'sum',

Loading…
Cancel
Save