Skip to content

Conversation

@malinajirka
Copy link
Contributor

@malinajirka malinajirka commented Sep 11, 2025

#WOOMOB-1312

Description

This PR

  • fixes mapping of localSiteId for WooPosProductEntity
  • adds WooPos prefix to product and variation entities

Testing information

This the code isn't used in this branch, there isn't much to test. If you'd like to test it, you can add apply the following patch. The sync will start when you access the POS - you can test switching site to see different ids in the DB.

Subject: [PATCH] Add WooPos prefix
---
Index: WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/WooPosItemsViewModel.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/WooPosItemsViewModel.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/WooPosItemsViewModel.kt
--- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/WooPosItemsViewModel.kt	(revision eedfeaec0309403fe79318716478cf5efd690f27)
+++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/WooPosItemsViewModel.kt	(date 1757588112196)
@@ -3,6 +3,7 @@
 import android.os.Parcelable
 import androidx.lifecycle.ViewModel
 import androidx.lifecycle.viewModelScope
+import com.woocommerce.android.tools.SelectedSite
 import com.woocommerce.android.ui.woopos.common.composeui.component.WooPosSearchInputState
 import com.woocommerce.android.ui.woopos.home.ChildToParentEvent
 import com.woocommerce.android.ui.woopos.home.ParentToChildrenEvent
@@ -12,6 +13,7 @@
 import com.woocommerce.android.ui.woopos.home.items.WooPosItemsToolbarViewState.Tab
 import com.woocommerce.android.ui.woopos.home.items.coupons.creation.WooPosCouponCreationFacade
 import com.woocommerce.android.ui.woopos.home.items.variations.WooPosVariationsNavigationData
+import com.woocommerce.android.ui.woopos.localcatalog.PosLocalCatalogSyncRepository
 import com.woocommerce.android.ui.woopos.util.analytics.WooPosAnalyticsEvent
 import com.woocommerce.android.ui.woopos.util.analytics.WooPosAnalyticsEvent.Event.SearchButtonTapped
 import com.woocommerce.android.ui.woopos.util.analytics.WooPosAnalyticsEventConstant
@@ -33,6 +35,8 @@
     private val fromChildToParentEventSender: WooPosChildrenToParentEventSender,
     private val parentToChildrenEventReceiver: WooPosParentToChildrenEventReceiver,
     private val analyticsTracker: WooPosAnalyticsTracker,
+    private val localCatalogSyncRepository: PosLocalCatalogSyncRepository,
+    private val selectedSite: SelectedSite,
 ) : ViewModel() {
     private var preservedStateBeforeOpeningVariations: WooPosItemsToolbarViewState? = null
     private val _viewState = MutableStateFlow<WooPosItemsToolbarViewState>(initialState())
@@ -49,6 +53,7 @@
             coroutineScope = viewModelScope,
             viewStateFlow = _viewState
         )
+        viewModelScope.launch { localCatalogSyncRepository.syncLocalCatalogFull(selectedSite.get()) }
     }
 
     fun onUIEvent(event: WooPosItemsUIEvent) {

The tests that have been performed

The above

Images/gif

Screenshot 2025-09-11 at 12 56 25
  • 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.

@malinajirka malinajirka added this to the 23.3 milestone Sep 11, 2025
@malinajirka malinajirka requested a review from kidinov September 11, 2025 10:56
@wpmobilebot
Copy link
Collaborator

📲 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
Commiteedfeae
Direct Downloadwoocommerce-wear-prototype-build-pr14603-eedfeae.apk

@wpmobilebot
Copy link
Collaborator

📲 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
Commiteedfeae
Direct Downloadwoocommerce-prototype-build-pr14603-eedfeae.apk

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 38.34%. Comparing base (8e63181) to head (eedfeae).

Files with missing lines Patch % Lines
...oid/ui/woopos/common/data/WooPosVariationMapper.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #14603      +/-   ##
============================================
- Coverage     38.34%   38.34%   -0.01%     
+ Complexity     9691     9690       -1     
============================================
  Files          2057     2057              
  Lines        115173   115172       -1     
  Branches      15314    15314              
============================================
- Hits          44158    44157       -1     
  Misses        66940    66940              
  Partials       4075     4075              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kidinov kidinov self-assigned this Sep 11, 2025
Copy link
Contributor

@kidinov kidinov left a comment

Choose a reason for hiding this comment

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

LGTM!

@kidinov kidinov merged commit 2be1ec9 into trunk Sep 11, 2025
21 of 22 checks passed
@kidinov kidinov deleted the issue/woomob-1312-woo-poslocal-catalog-localsiteid-is-always-0 branch September 11, 2025 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants