Refactor PI

This commit is contained in:
Matt-Yorkley
2017-10-29 14:05:13 +00:00
parent 1ff39b8df5
commit 1ed49d397e
4 changed files with 20 additions and 22 deletions

View File

@@ -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