Skip to content

📊 feat(Analytics): enhance datasource#2554

Open
Rello wants to merge 3 commits into
mainfrom
feature/anayltics-datasource
Open

📊 feat(Analytics): enhance datasource#2554
Rello wants to merge 3 commits into
mainfrom
feature/anayltics-datasource

Conversation

@Rello

@Rello Rello commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

The datasource for the Analytics app is enhanced to provide more reporting capabilities:

  • A count column=1 is added for statistics in Analytics

The datasource now returns analytics-friendly scalar values for:

  • single selections as option labels
  • multi selections as comma-separated option labels
  • checkbox selections as true / false
  • text links as Title (URL) when a title exists, or only the URL when title is empty
  • rich/long/line text with HTML tags stripped
  • user/group/team values as comma-separated display names or IDs
  • blank cells backed by column defaults, including number, text, selection, datetime, and usergroup defaults

Unit test was added

@Rello Rello requested review from blizzz and enjeck as code owners April 29, 2026 18:09
@Rello Rello changed the title feat(Analytics): enhance datasource 📊 feat(Analytics): enhance datasource Apr 29, 2026
@Rello

Rello commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author
Bildschirmfoto 2026-04-29 um 20 11 12

@Rello

Rello commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

Playwright tests are not relevant to this Analytics datasource

@AndyScherzinger AndyScherzinger added enhancement New feature or request 3. to review Waiting for reviews AI assisted labels Jun 6, 2026
@enjeck enjeck force-pushed the feature/anayltics-datasource branch from 5d57359 to ec1a744 Compare June 15, 2026 16:35
Rello added 2 commits June 15, 2026 17:35
Signed-off-by: Rello <github@scherello.de>
Signed-off-by: Rello <github@scherello.de>
@enjeck enjeck force-pushed the feature/anayltics-datasource branch from ec1a744 to 21ce9c5 Compare June 15, 2026 16:35

@enjeck enjeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some comments

Comment on lines +258 to +259
if ($value === '') {
$value = $this->formatDefaultValue($column);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why switch from number to every type? So a cell that's legitimately empty on a column that has a default (text/selection/usergroup) will now render the default instead of blank? Is that the intendion for these types, or should the default only fill truly-missing cells rather than empty-string values?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,
good question. Can a cell value be completely missing?
Aim is e.g. a count-column for row counts. make it default=1 but the user does not need to fill the column. is this empty or ''?

Comment on lines +346 to +349
$value = (string)$value;
if ($column->getSubtype() === 'link') {
return $this->formatLinkValue($value);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use the predefined constants instead of hardcoding e.g SUBTYPE_TEXT_LINK

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the hint. makes sense. I will change it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,
I misunderstood this comment. I thought that these were types from the app already. This string is only used one time, so there is no reusable to put it in a constant for just this datasource

}

private function isMultiSelection(Column $column): bool {
return in_array($column->getSubtype(), [Column::SUBTYPE_SELECTION_MULTI, 'multi'], true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure we need the multi option

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems there was some usage so it looks like a legacy case
https://github.com/nextcloud/tables/blob/main/lib/Db/Row2Mapper.php#L477

Comment thread tests/unit/Analytics/AnalyticsDatasourceTest.php Outdated
Signed-off-by: Rello <Rello@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews AI assisted enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants