Skip to content

Commit

Permalink
fix: Remove totals table rows from displayed row count (#1492)
Browse files Browse the repository at this point in the history
Fixes #1407. When aggregations were added, both the table and column
tooltips displayed an increased row count to account for the totals
table. Rows from the totals table are now subtracted from the row count
displayed to users.
  • Loading branch information
georgecwan authored Sep 7, 2023
1 parent 02841b5 commit f686891
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ interface IrisGridPanelTooltipProps {
function IrisGridPanelTooltip(props: IrisGridPanelTooltipProps): ReactElement {
const { model, widgetName, glContainer, description } = props;

const rowCount = (model?.rowCount ?? 0) - (model?.pendingRowCount ?? 0);
const rowCount =
(model?.rowCount ?? 0) -
(model?.pendingRowCount ?? 0) -
(model?.floatingBottomRowCount ?? 0) -
(model?.floatingTopRowCount ?? 0);
const formattedRowCount = model?.displayString(rowCount, 'long');

const columnCount = model?.columnCount ?? 0;
Expand Down
12 changes: 10 additions & 2 deletions packages/iris-grid/src/ColumnStatistics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ class ColumnStatistics extends Component<
maybeGenerateStatistics(): void {
const { model } = this.props;

const numRows = model.rowCount - model.pendingRowCount;
const numRows =
model.rowCount -
model.pendingRowCount -
model.floatingBottomRowCount -
model.floatingTopRowCount;
this.setState({ numRows });
if (!model.isColumnStatisticsAvailable) {
this.setState({ loading: false });
Expand Down Expand Up @@ -133,7 +137,11 @@ class ColumnStatistics extends Component<
this.setState({
loading: false,
statistics,
numRows: model.rowCount - model.pendingRowCount,
numRows:
model.rowCount -
model.pendingRowCount -
model.floatingBottomRowCount -
model.floatingTopRowCount,
});

onStatistics();
Expand Down

0 comments on commit f686891

Please sign in to comment.