lib/rsr_group/order.rb in rsr_group-1.7.0 vs lib/rsr_group/order.rb in rsr_group-1.7.1
- old
+ new
@@ -105,10 +105,14 @@
# For our purposes, only 1 recipient can ever be allowed in an RSR order
["FILETRAILER", LINE_TYPES.key(:file_trailer), '00001'].join(";")
end
def order_trailer
- [@identifier, LINE_TYPES.key(:order_trailer), ("%07d" % @items.length)].join(";")
+ [@identifier, LINE_TYPES.key(:order_trailer), ("%07d" % total_quantity)].join(";")
+ end
+
+ def total_quantity
+ @items.map { |x| x.quantity.to_i }.inject(0, :+)
end
end
end