Exclude cancelled orders from bulk co-op reports#14415
Open
karlafalk wants to merge 8 commits into
Open
Conversation
Base was explicitly passing CompleteVisibleOrdersQuery without the .not_state(:canceled) filter, overriding LineItems' default which already excludes cancelled orders. Removing the explicit argument lets the default apply, fixing the bug with a one-line change. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What? Why?
Closes #10159
Cancelled orders were appearing in all bulk co-op reports. BulkCoop::Base#report_line_items was passing CompleteVisibleOrdersQuery.new(order_permissions).call as an explicit orders_relation to Reporting::LineItems. This bypassed the default relation in LineItems#initialize, which already excludes cancelled orders via .not_state(:canceled).
Fix: Remove the explicit orders_relation argument so LineItems uses its default, which correctly excludes cancelled orders.
What should we test?
Release notes
Changelog Category (reviewers may add a label for the release notes):
Note: The n8n workflow docs and GOAT agent files appearing in this diff are pre-existing commits on the my fork unrelated to this fix. Only lib/reporting/reports/bulk_coop/base.rb and spec/lib/reports/bulk_coop_report_spec.rb are part of this change. I wasn't sure how to remove these unrelated files without doing a force-push.