Skip to content

[Bugfix:Forum] Show deleted post stats#12711

Merged
bmcutler merged 4 commits into
Submitty:mainfrom
not-so-shubh:bugfix/forum-deleted-post-stats
Apr 28, 2026
Merged

[Bugfix:Forum] Show deleted post stats#12711
bmcutler merged 4 commits into
Submitty:mainfrom
not-so-shubh:bugfix/forum-deleted-post-stats

Conversation

@not-so-shubh

@not-so-shubh not-so-shubh commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Why is this Change Important & Necessary?

Fixes #12706

Users with only deleted forum posts do not appear on /forum/stats.

Currently, the stats page builds its user list from visible posts and upducks only. As a result, users with only deleted posts are never added to the stats data, even though deleted post counts are displayed in the table.


What is the New Behavior?

Users with deleted-post-only activity are now included in forum stats.

The controller now:

  • initializes forum stats users through a shared helper for consistent defaults
  • aggregates deleted post counts efficiently
  • seeds users from deleted post activity in addition to visible posts and upducks

As a result, users with only deleted posts now appear on /forum/stats with:

  • the correct deleted post count
  • zero visible post/thread counts where applicable

Screenshots:

  • Before: stats page with only deleted posts present and no user row shown
Screenshot 2026-03-31 at 22 09 39
  • After: stats page showing the deleted-post-only user row
Screenshot 2026-04-01 at 15 29 20

What steps should a reviewer take to reproduce or test the bug or new feature?

  1. Go to the discussion forum in a course
  2. Create a scenario where a user has only deleted forum posts and no visible posts
  3. Visit /forum/stats

Before this change:

  • the user does not appear in the stats table

After this change:

  • the user appears in the stats table with the correct deleted post count

Additional checks:

  1. Verify a user with visible posts and deleted posts still shows correct stats
  2. Verify a user with only upducks still appears correctly
  3. Verify normal forum stats behavior is otherwise unchanged

Automated Testing & Documentation

This change was manually tested on the forum stats page.

No automated tests were added. A follow-up issue can be opened for test coverage of forum stats edge cases if needed.

No submitty.org documentation changes are required, as this fixes existing behavior.


Other information

  • Not a breaking change
  • No migrations required
  • No known security concerns

Copilot AI review requested due to automatic review settings March 31, 2026 16:41

Copilot AI 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.

Pull request overview

Fixes forum statistics aggregation so users with only deleted forum posts are included on /forum/stats, aligning the displayed “Total Deleted Posts” column with the set of users shown.

Changes:

  • Added a shared helper to initialize forum stats user entries with consistent default fields.
  • Added an aggregated query to compute deleted post counts per user (instead of per-user queries).
  • Seeded the stats user list from deleted-post activity in addition to visible posts and upducks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread site/app/controllers/forum/ForumController.php Outdated
@codecov

codecov Bot commented Mar 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.17647% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.75%. Comparing base (02638f6) to head (ec5cfcf).
⚠️ Report is 34 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main   #12711      +/-   ##
============================================
+ Coverage     21.64%   21.75%   +0.10%     
- Complexity     9654     9658       +4     
============================================
  Files           268      268              
  Lines         36245    36261      +16     
  Branches        487      487              
============================================
+ Hits           7846     7888      +42     
+ Misses        27916    27890      -26     
  Partials        483      483              
Flag Coverage Δ
autograder 21.32% <ø> (ø)
js 2.04% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.79% <91.17%> (+0.12%) ⬆️
python_submitty_utils 80.08% <ø> (ø)
submitty_daemon_jobs 91.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dagemcn dagemcn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Functionality looks good. I scanned the code and it looks good as well. Good work here.

@github-project-automation github-project-automation Bot moved this from Seeking Reviewer to Awaiting Maintainer Review in Submitty Development Apr 14, 2026

@Farhanxikram Farhanxikram left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey, I did a functionality test on this, and everything seemed good. Everything is working as specified, and it didn't break anything as far as I could tell :)
Os: Windows
Browser: Chrome

@bmcutler
bmcutler merged commit 131021c into Submitty:main Apr 28, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Forum stats not shown when only deleted posts exist

5 participants