mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Guard against nil values
These are validated and shouldn't be nil, but I suspect we have corrupt data causing problems here.
This commit is contained in:
@@ -56,9 +56,9 @@
|
||||
-# TODO: new requirement "DISPLAY ON DEMAND IF ALL VARIANTS ARE ON DEMAND". And translate value
|
||||
.content= if product.variants.all?(&:on_demand) then "On demand" else product.on_hand || 0 end
|
||||
%td.align-left
|
||||
.content= product.supplier.name
|
||||
.content= product.supplier&.name
|
||||
%td.align-left
|
||||
.content= product.primary_taxon.name
|
||||
.content= product.primary_taxon&.name
|
||||
%td.align-left
|
||||
%td.align-left
|
||||
.content= product.inherits_properties ? 'YES' : 'NO' #TODO: consider using https://github.com/RST-J/human_attribute_values, else use I18n.t (also below)
|
||||
@@ -82,7 +82,7 @@
|
||||
%td.align-right
|
||||
.content= variant.on_hand || 0 #TODO: spec for this according to requirements.
|
||||
%td.align-left
|
||||
.content= variant.product.supplier.name # same as product
|
||||
.content= variant.product.supplier&.name # same as product
|
||||
%td.align-left
|
||||
-# empty
|
||||
%td.align-left
|
||||
|
||||
Reference in New Issue
Block a user