-
Notifications
You must be signed in to change notification settings - Fork 133
[WOOMOB-1443] Filter out unsupported products and variations in Local Catalog #14767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WOOMOB-1443] Filter out unsupported products and variations in Local Catalog #14767
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR moves product and variation filtering from the application layer to the database layer, ensuring only supported items (published, non-downloadable, simple/variable products) are retrieved from the Local Catalog. This change improves performance by reducing in-memory filtering and ensures consistency across the POS feature.
- Filtering moved from application layer to database queries for products and variations
- Added SQL conditions to filter out unpublished, downloadable, and unsupported product types
- Removed redundant
applyFilter()
function since filtering now happens at database level
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
WooPosProductsDao.kt | Added SQL filters for status, product type, and downloadable flag to product query |
WooPosVariationsDao.kt | Added SQL filters for status and downloadable flag to variation query |
WooPosVariationsInDbDataSource.kt | Removed application-layer filtering function now handled by database |
WooPosProductsTypesFilterConfig.kt | Added clarifying comment about Local Catalog filtering location |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
...lugin/src/main/kotlin/org/wordpress/android/fluxc/persistence/dao/pos/WooPosVariationsDao.kt
Outdated
Show resolved
Hide resolved
...-plugin/src/main/kotlin/org/wordpress/android/fluxc/persistence/dao/pos/WooPosProductsDao.kt
Outdated
Show resolved
Hide resolved
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
import org.wordpress.android.fluxc.store.WCProductStore.ProductFilterOption | ||
import javax.inject.Inject | ||
|
||
// Note: For the Local Catalog feature, the filtering is done locally in WooPosProductsDao. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing the comment, I assume you considered reusing this for the filteriting to have a single source of truth for the whole POS; therefore, just curious why you didn't go with that approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I couldn't figure out a way on how to re-use it.
- We likely want to filter on the DB layer for performance/memory reasons.
- This config lives in a different module than the DB -> we can't create a circular dependency.
- Room queries can reference only constants.
Wdyt? Can you think of a way on how to re-use it?
#WOOMOB-1443
Description
This PR filters out unsupported products and variations in the Local Catalog. Variations were filtered out even before, but they are filtered out on the database layer now.
Testing information
The tests that have been performed
The above
Images/gif
N/A
RELEASE-NOTES.txt
if necessary. Use the "[Internal]" label for non-user-facing changes.