I am fairly new to RoR. I have the following codes and uses a simple summation and division, but the value I get is 0. Not sure where I went wrong. Thx
- capacity_left = (total_capacity / total_amps) rescue 0
h4 = "Capacity Reserve Left: #{capacity_left} Hrs "
- total_amps = @site.equipment_inventories.sum {|e| e.equipment.amp.amp }
h5 = "Total Amps: #{total_amps} amp"
- total_capacity = @site.dc_power_inventories.sum {|d| d.dc_power_supply.battery.capacity.capacity }
h5 = "Total Capcity: #{total_capacity} Amp/hr"