mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-24 01:13:21 +00:00
Refactor PI
This commit is contained in:
@@ -7,17 +7,13 @@ angular.module("ofn.admin").filter 'entriesFilterValid', ->
|
||||
|
||||
angular.forEach entries, (entry, line_number) ->
|
||||
validates_as = entry.validates_as
|
||||
if type == 'valid' and (validates_as != '')
|
||||
filtered[line_number] = entry
|
||||
if type == 'invalid' and (validates_as == '')
|
||||
filtered[line_number] = entry
|
||||
if type == 'create_product' and (validates_as == 'new_product' or validates_as == 'new_variant')
|
||||
filtered[line_number] = entry
|
||||
if type == 'update_product' and validates_as == 'existing_variant'
|
||||
filtered[line_number] = entry
|
||||
if type == 'create_inventory' and validates_as == 'new_inventory_item'
|
||||
filtered[line_number] = entry
|
||||
if type == 'update_inventory' and validates_as == 'existing_inventory_item'
|
||||
|
||||
if type == 'valid' and validates_as != '' \
|
||||
or type == 'invalid' and validates_as == '' \
|
||||
or type == 'create_product' and validates_as == 'new_product' or validates_as == 'new_variant' \
|
||||
or type == 'update_product' and validates_as == 'existing_variant' \
|
||||
or type == 'create_inventory' and validates_as == 'new_inventory_item' \
|
||||
or type == 'update_inventory' and validates_as == 'existing_inventory_item'
|
||||
filtered[line_number] = entry
|
||||
|
||||
filtered
|
||||
|
||||
Reference in New Issue
Block a user