Skip to content

fix(analytics): count answers per question and handle forms without answers - #3869

Merged
AndyScherzinger merged 2 commits into
mainfrom
fix/analytics-answer-counts
Nov 11, 2026
Merged

AndyScherzinger merged 2 commits into
mainfrom
fix/analytics-answer-counts

Conversation

@AndyScherzinger

Copy link
Copy Markdown
Member

Split out of #3833, so it can be merged and backported on its own. The commits are unchanged and drop out of #3833 once this is merged.

  • The Analytics data source no longer fails on forms without answers and ignores answers of deleted questions.
  • Answers are counted per question, so a "|" in a title or answer and questions with the same title no longer mix up the counts.

Tests

  • AnalyticsDatasourceTest covers both; it needs the Analytics app and runs on CI.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

The data of a form without answers was never initialized, so sorting it
failed. Answers of deleted questions were counted for a question without
text.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The Analytics data source counted answers under the key "question
text|answer text" and split that key at "|" again. A "|" in a question
title or an answer cut the texts apart, and questions with the same
title shared one count.

Count the answers per question id and answer text instead.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@AndyScherzinger AndyScherzinger added bug Something isn't working 3. to review Waiting for reviews labels Nov 11, 2026
@AndyScherzinger AndyScherzinger self-assigned this Nov 11, 2026
@codecov

codecov Bot commented Nov 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/Analytics/AnalyticsDatasource.php 0.00% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Chartman123

Copy link
Copy Markdown
Collaborator

/backport to stable5.4

@backportbot backportbot Bot added the backport-request Pending backport by the backport-bot label Nov 11, 2026
@AndyScherzinger
AndyScherzinger merged commit abda850 into main Nov 11, 2026
50 of 51 checks passed
@AndyScherzinger
AndyScherzinger deleted the fix/analytics-answer-counts branch November 11, 2026 09:07
@backportbot backportbot Bot removed the backport-request Pending backport by the backport-bot label Nov 11, 2026
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 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants