Make total number of products in exchange work again.

Currently we are just loading the products from the server and count them.
This can be improved easily in two ways:
- we can switch this to a specific product count call to the server so that we dont load all products all the time
- or we paginate the products result and fetch the total_number from the payload of the first page.
This commit is contained in:
luisramos0
2019-11-11 13:21:33 +00:00
parent 2b3bc6d1ff
commit 3223bf930d
6 changed files with 45 additions and 34 deletions

View File

@@ -56,16 +56,3 @@ describe 'Enterprise service', ->
master_id: 1
variants: [{id: 2}, {id: 3}]
expect(Enterprise.variantsOf(p)).toEqual [2, 3]
it 'counts total variants supplied by an enterprise', ->
enterprise =
supplied_products: [
{variants: []},
{variants: []},
{variants: [{}, {}, {}]}
]
expect(Enterprise.totalVariants(enterprise)).toEqual(5)
it 'returns zero when enterprise is null', ->
expect(Enterprise.totalVariants(null)).toEqual(0)