Skip to content
This repository has been archived by the owner on Feb 4, 2025. It is now read-only.

Commit

Permalink
Merge pull request #1419 from wordpress-mobile/wc/has-orders
Browse files Browse the repository at this point in the history
Add a new `hasCachedOrdersForSite()` method to WCOrderStore
  • Loading branch information
anitaa1990 authored Nov 5, 2019
2 parents eccb453 + eb3fb3f commit 4e50386
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@ class WCOrderStore @Inject constructor(dispatcher: Dispatcher, private val wcOrd
fun getShipmentProvidersForSite(site: SiteModel): List<WCOrderShipmentProviderModel> =
OrderSqlUtils.getOrderShipmentProvidersForSite(site)

/**
* @return Returns true if orders for the provided site exist in the DB, else false.
*/
fun hasCachedOrdersForSite(site: SiteModel) = OrderSqlUtils.getOrdersForSite(site).isNotEmpty()

@Subscribe(threadMode = ThreadMode.ASYNC)
override fun onAction(action: Action<*>) {
val actionType = action.type as? WCOrderAction ?: return
Expand Down

0 comments on commit 4e50386

Please sign in to comment.