Skip to content
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

[Woo POS][non-simple products] Force refresh products while fetching from POS #13018

Merged
merged 9 commits into from
Nov 29, 2024

Conversation

AnirudhBhat
Copy link
Contributor

@AnirudhBhat AnirudhBhat commented Nov 27, 2024

Please ensure to review and merge the fluxc PR and update the fluxc hash commit in this PR before merging this one.

Closes: #13015

Description

This PR passes in forceRefresh boolean value while fetching products from POS which would cause deleting stale products before inserting new products into the database.

This is needed since stale variation products gets created and are added to the database each time we checkout and complete transaction successfully that contains variations. You can notice this after successful checkout, if you come back to the POS items list after visiting the order details screen.

You can notice similar behaviour in the products tab as well. Since we are removing the stale products there, it just appears for few seconds and then disappears.

Steps to reproduce

  1. Navigate to the POS (more menu -> POS)
  2. Add variation to the cart and then checkout
  3. Ensure the transaction completes successfully
  4. Navigate to the order detail screen and open the newly created order
  5. Come back to the POS mode
  6. Here, you observe stale variation products being listed in the items list

Testing information

Also test that the products section in the store management works fine without any side affect of this change.

The tests that have been performed

Followed the steps to reproduce and ensured that stale products are no longer listed in the items list in POS

Images/gif

Before this PR

stale_variations.mp4

After this PR

stale_variations_removed.mp4
  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

@AnirudhBhat AnirudhBhat added type: bug A confirmed bug. feature: point of sale POS project labels Nov 27, 2024
@AnirudhBhat AnirudhBhat added the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Nov 27, 2024
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 27, 2024

Project dependencies changes

The following changes in project dependencies were detected (configuration vanillaReleaseRuntimeClasspath):

list
Upgraded Dependencies
org.wordpress.fluxc.plugins:woocommerce:trunk-3d4558601eaa4fc1d4a0254c6caff5f7c87732bb, (changed from trunk-b1086fc19b68a57592f6b337d8044b39296ed12c)
org.wordpress.fluxc:fluxc-annotations:trunk-3d4558601eaa4fc1d4a0254c6caff5f7c87732bb, (changed from trunk-b1086fc19b68a57592f6b337d8044b39296ed12c)
org.wordpress:fluxc:trunk-3d4558601eaa4fc1d4a0254c6caff5f7c87732bb, (changed from trunk-b1086fc19b68a57592f6b337d8044b39296ed12c)
tree
-+--- org.wordpress:fluxc:trunk-b1086fc19b68a57592f6b337d8044b39296ed12c
-|    +--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.25 -> 2.0.21
-|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:2.0.21 (*)
-|    |    \--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.0.21
-|    |         \--- org.jetbrains.kotlin:kotlin-stdlib:2.0.21 (*)
-|    +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.3.6
-|    |    \--- androidx.annotation:annotation:1.2.0 -> 1.8.0 (*)
-|    +--- androidx.security:security-crypto:1.0.0 -> 1.1.0-alpha03
-|    |    +--- androidx.annotation:annotation:1.1.0 -> 1.8.0 (*)
-|    |    +--- com.google.crypto.tink:tink-android:1.5.0
-|    |    \--- androidx.collection:collection:1.1.0 -> 1.4.0 (*)
-|    +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0
-|    |    +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.12.0 (*)
-|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10 -> 1.9.10 (*)
-|    +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
-|    +--- org.apache.commons:commons-text:1.10.0 (*)
-|    +--- androidx.room:room-runtime:2.6.1 (*)
-|    +--- androidx.room:room-ktx:2.6.1
-|    |    +--- androidx.room:room-common:2.6.1 (*)
-|    |    +--- androidx.room:room-runtime:2.6.1 (*)
-|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.0.21 (*)
-|    |    +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.8.1 (*)
-|    |    +--- androidx.room:room-common:2.6.1 (c)
-|    |    \--- androidx.room:room-runtime:2.6.1 (c)
-|    +--- com.google.dagger:dagger:2.51.1
-|    |    \--- javax.inject:javax.inject:1
-|    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1 (*)
-|    +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1 (*)
-|    +--- org.wordpress:wellsql:2.0.0
-|    |    +--- androidx.annotation:annotation:1.2.0 -> 1.8.0 (*)
-|    |    \--- org.wordpress.wellsql:wellsql-annotations:2.0.0
-|    +--- org.wordpress.fluxc:fluxc-annotations:trunk-b1086fc19b68a57592f6b337d8044b39296ed12c
-|    +--- org.greenrobot:eventbus:3.3.1 (*)
-|    +--- org.greenrobot:eventbus-java:3.3.1
-|    +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.12.0 (*)
-|    +--- com.android.volley:volley:1.1.1 -> 1.2.0
-|    +--- androidx.paging:paging-runtime:2.1.2
-|    |    +--- androidx.paging:paging-common:2.1.2
-|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.8.0 (*)
-|    |    |    \--- androidx.arch.core:core-common:2.0.0 -> 2.2.0 (*)
-|    |    +--- androidx.arch.core:core-runtime:2.0.0 -> 2.2.0 (*)
-|    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.7.0 (*)
-|    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.7.0 (*)
-|    |    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.3.2 (*)
-|    +--- com.goterl:lazysodium-android:5.0.2
-|    +--- net.java.dev.jna:jna:5.5.0
-|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.25 -> 2.0.21 (*)
++--- org.wordpress:fluxc:trunk-3d4558601eaa4fc1d4a0254c6caff5f7c87732bb
+|    +--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.25 -> 2.0.21
+|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:2.0.21 (*)
+|    |    \--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.0.21
+|    |         \--- org.jetbrains.kotlin:kotlin-stdlib:2.0.21 (*)
+|    +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.3.6
+|    |    \--- androidx.annotation:annotation:1.2.0 -> 1.8.0 (*)
+|    +--- androidx.security:security-crypto:1.0.0 -> 1.1.0-alpha03
+|    |    +--- androidx.annotation:annotation:1.1.0 -> 1.8.0 (*)
+|    |    +--- com.google.crypto.tink:tink-android:1.5.0
+|    |    \--- androidx.collection:collection:1.1.0 -> 1.4.0 (*)
+|    +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0
+|    |    +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.12.0 (*)
+|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10 -> 1.9.10 (*)
+|    +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
+|    +--- org.apache.commons:commons-text:1.10.0 (*)
+|    +--- androidx.room:room-runtime:2.6.1 (*)
+|    +--- androidx.room:room-ktx:2.6.1
+|    |    +--- androidx.room:room-common:2.6.1 (*)
+|    |    +--- androidx.room:room-runtime:2.6.1 (*)
+|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.0.21 (*)
+|    |    +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.8.1 (*)
+|    |    +--- androidx.room:room-common:2.6.1 (c)
+|    |    \--- androidx.room:room-runtime:2.6.1 (c)
+|    +--- com.google.dagger:dagger:2.51.1
+|    |    \--- javax.inject:javax.inject:1
+|    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1 (*)
+|    +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1 (*)
+|    +--- org.wordpress:wellsql:2.0.0
+|    |    +--- androidx.annotation:annotation:1.2.0 -> 1.8.0 (*)
+|    |    \--- org.wordpress.wellsql:wellsql-annotations:2.0.0
+|    +--- org.wordpress.fluxc:fluxc-annotations:trunk-3d4558601eaa4fc1d4a0254c6caff5f7c87732bb
+|    +--- org.greenrobot:eventbus:3.3.1 (*)
+|    +--- org.greenrobot:eventbus-java:3.3.1
+|    +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.12.0 (*)
+|    +--- com.android.volley:volley:1.1.1 -> 1.2.0
+|    +--- androidx.paging:paging-runtime:2.1.2
+|    |    +--- androidx.paging:paging-common:2.1.2
+|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.8.0 (*)
+|    |    |    \--- androidx.arch.core:core-common:2.0.0 -> 2.2.0 (*)
+|    |    +--- androidx.arch.core:core-runtime:2.0.0 -> 2.2.0 (*)
+|    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.7.0 (*)
+|    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.7.0 (*)
+|    |    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.3.2 (*)
+|    +--- com.goterl:lazysodium-android:5.0.2
+|    +--- net.java.dev.jna:jna:5.5.0
+|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.25 -> 2.0.21 (*)
-\--- org.wordpress.fluxc.plugins:woocommerce:trunk-b1086fc19b68a57592f6b337d8044b39296ed12c
-     +--- org.wordpress:fluxc:trunk-b1086fc19b68a57592f6b337d8044b39296ed12c (*)
-     +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
-     +--- com.google.dagger:dagger:2.51.1 (*)
-     +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1 (*)
-     +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1 (*)
-     +--- androidx.room:room-runtime:2.6.1 (*)
-     +--- org.wordpress:wellsql:2.0.0 (*)
-     +--- org.wordpress.fluxc:fluxc-annotations:trunk-b1086fc19b68a57592f6b337d8044b39296ed12c
-     +--- androidx.room:room-ktx:2.6.1 (*)
-     \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.25 -> 2.0.21 (*)
+\--- org.wordpress.fluxc.plugins:woocommerce:trunk-3d4558601eaa4fc1d4a0254c6caff5f7c87732bb
+     +--- org.wordpress:fluxc:trunk-3d4558601eaa4fc1d4a0254c6caff5f7c87732bb (*)
+     +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
+     +--- com.google.dagger:dagger:2.51.1 (*)
+     +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1 (*)
+     +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1 (*)
+     +--- androidx.room:room-runtime:2.6.1 (*)
+     +--- org.wordpress:wellsql:2.0.0 (*)
+     +--- org.wordpress.fluxc:fluxc-annotations:trunk-3d4558601eaa4fc1d4a0254c6caff5f7c87732bb
+     +--- androidx.room:room-ktx:2.6.1 (*)
+     \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.25 -> 2.0.21 (*)

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 27, 2024

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit1aed772
Direct Downloadwoocommerce-wear-prototype-build-pr13018-1aed772.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 27, 2024

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit1aed772
Direct Downloadwoocommerce-prototype-build-pr13018-1aed772.apk

@AnirudhBhat AnirudhBhat marked this pull request as ready for review November 28, 2024 03:36
Base automatically changed from issue/12846-analytics-for-variations to trunk November 28, 2024 06:34
Copy link
Collaborator

@samiuelson samiuelson left a comment

Choose a reason for hiding this comment

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

LGTM

@AnirudhBhat AnirudhBhat removed the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Nov 29, 2024
@AnirudhBhat AnirudhBhat added this to the 21.3 milestone Nov 29, 2024
@AnirudhBhat AnirudhBhat merged commit 7f56f0a into trunk Nov 29, 2024
17 checks passed
@AnirudhBhat AnirudhBhat deleted the issue/13015-remove-stale-products branch November 29, 2024 09:03
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 33.33333% with 8 lines in your changes missing coverage. Please review.

Project coverage is 40.13%. Comparing base (4d873d6) to head (1aed772).
Report is 31 commits behind head on trunk.

Files with missing lines Patch % Lines
...id/ui/woopos/home/totals/WooPosTotalsRepository.kt 20.00% 4 Missing ⚠️
...android/ui/products/selector/ProductListHandler.kt 50.00% 0 Missing and 2 partials ⚠️
.../ui/products/selector/ProductSelectorRepository.kt 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##              trunk   #13018   +/-   ##
=========================================
  Coverage     40.13%   40.13%           
  Complexity     6120     6120           
=========================================
  Files          1280     1280           
  Lines         74008    74012    +4     
  Branches      10122    10124    +2     
=========================================
+ Hits          29703    29705    +2     
- Misses        41725    41727    +2     
  Partials       2580     2580           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: point of sale POS project type: bug A confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Woo POS][non-simple products] Items list doesn't delete stale products
4 participants