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:
David Cook
2023-10-13 10:43:55 +11:00
committed by Konrad
parent a0b64cb58a
commit 8f30b27b58

View File

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