Skip to content

perf: count form submissions in bulk for the forms list - #3734

Merged
Koc merged 1 commit into
mainfrom
feature/forms-list-bulk-submission-count
Oct 11, 2026
Merged

Koc merged 1 commit into
mainfrom
feature/forms-list-bulk-submission-count

Conversation

@Koc

@Koc Koc commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

The /ocs/v2.php/apps/forms/api/v3/forms endpoint ran one countSubmissions() query per listed form. Add
SubmissionMapper::countSubmissionsByForms() which counts submissions for many forms with a single WHERE form_id IN (...) GROUP BY form_id query, served by the forms_submissions_form_user index, and let FormsService::getPartialFormArrays() fetch the counts for the whole list with at most two queries: one for forms where the user may see all results and one for forms where only their own submissions count.

Assisted-by: Devin:SWE-2

before
image

after
image

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (N/A)

@Koc Koc added php PHP related ticket 3. to review Waiting for reviews performances Performances issues and optimisations labels Oct 7, 2026
@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.91667% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/Controller/ApiController.php 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Koc
Koc force-pushed the feature/forms-list-bulk-submission-count branch from df0455e to 3f8acc6 Compare October 7, 2026 21:13
@Koc
Koc marked this pull request as ready for review October 7, 2026 21:15
@Koc
Koc requested review from Chartman123 and susnux October 7, 2026 21:49
@Chartman123
Chartman123 force-pushed the feature/forms-list-bulk-submission-count branch from 3f8acc6 to 986538a Compare October 11, 2026 20:59
@Chartman123

Copy link
Copy Markdown
Collaborator

/backport to stable5.4

@backportbot backportbot Bot added the backport-request Pending backport by the backport-bot label Oct 11, 2026
Comment thread lib/Controller/ApiController.php
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
@Koc
Koc force-pushed the feature/forms-list-bulk-submission-count branch from 986538a to 1334283 Compare October 11, 2026 22:06
@Koc
Koc enabled auto-merge (squash) October 11, 2026 22:07
@Koc
Koc merged commit 2b14865 into main Oct 11, 2026
51 checks passed
@Koc
Koc deleted the feature/forms-list-bulk-submission-count branch October 11, 2026 22:13
@backportbot

backportbot Bot commented Oct 11, 2026

Copy link
Copy Markdown

The backport to stable5.4 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable5.4
git pull origin stable5.4

# Create the new backport branch
git checkout -b backport/3734/stable5.4

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick 1334283d

# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/3734/stable5.4

Error: Failed to cherry pick commits: error: no cherry-pick or revert in progress
fatal: cherry-pick failed


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@Chartman123

Copy link
Copy Markdown
Collaborator

@Koc could you please look into the failed backport and do it manually?

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 backport-request Pending backport by the backport-bot performances Performances issues and optimisations php PHP related ticket

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants