Skip to content

Fix PG::UndefinedColumn: column orders.product_id does not exist#11218

Merged
nbudin merged 1 commit intomainfrom
11217-fix-orders-product-id-column
Mar 9, 2026
Merged

Fix PG::UndefinedColumn: column orders.product_id does not exist#11218
nbudin merged 1 commit intomainfrom
11217-fix-orders-product-id-column

Conversation

@nbudin
Copy link
Contributor

@nbudin nbudin commented Mar 9, 2026

Summary

  • Fixes PG::UndefinedColumn crash in ConventionReportsPresenter#sales_count_by_product_and_payment_amount
  • product_id lives on order_entries, not orders — the bare symbol references in .group, .where.not, and .pluck were being resolved against the primary orders table
  • Qualified all three references as "order_entries.product_id" / order_entries: { product_id: nil }
  • Added a regression test that reproduces the original error and passes after the fix

Fixes #11217

Test plan

  • Run bundle exec ruby -Itest test/presenters/convention_reports_presenter_test.rb — all 5 tests pass
  • Visit the convention reports page on a convention with completed orders and verify the attendance by payment amount report loads without error

🤖 Generated with Claude Code

…able (#11217)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nbudin nbudin added bug patch Bumps the patch version number on release labels Mar 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

Code Coverage Report: Only Changed Files listed

Package Base Coverage New Coverage Difference
app/models/convention.rb 🟢 86.03% 🟢 86.76% 🟢 0.73%
app/presenters/convention_reports_presenter.rb 🟠 50% 🟠 58.7% 🟢 8.7%
Overall Coverage 🟢 52.62% 🟢 52.66% 🟢 0.04%

Minimum allowed coverage is 0%, this run produced 52.66%

@nbudin nbudin merged commit 3a458c1 into main Mar 9, 2026
19 checks passed
@nbudin nbudin deleted the 11217-fix-orders-product-id-column branch March 9, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug patch Bumps the patch version number on release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column orders.product_id does not exist (ActiveRecord::StatementInvalid)

1 participant