mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-14 04:04:23 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user