adds constants and class variables 2
This commit is contained in:
@@ -181,7 +181,7 @@ class Reading < ActiveRecord::Base
|
||||
p "Battery is now at %s kwh" % @@battery_kwh
|
||||
return kwh
|
||||
else
|
||||
old_kwh = @battery_kwh
|
||||
old_kwh = @@battery_kwh
|
||||
@@battery_kwh = BATTERY_MAX_KWH
|
||||
p "Battery is now at %s kwh" % @@battery_kwh
|
||||
return (BATTERY_MAX_KWH-old_kwh)
|
||||
@@ -231,7 +231,7 @@ class Reading < ActiveRecord::Base
|
||||
else
|
||||
easy_usage_rate, easy_return_rate = easy_energy_rate(formatted_hour)
|
||||
# if rate > charge_rate + 0.05 || more than 5.0 kwh then discharge_battery
|
||||
if @battery_kwh > 5.0 || (easy_usage_rate.to_f > (low_usage_rate.to_f + 0.05))
|
||||
if @@battery_kwh > 5.0 || (easy_usage_rate.to_f > (low_usage_rate.to_f + 0.05))
|
||||
usage_kwh -= discharge_battery(usage_kwh)
|
||||
end
|
||||
end
|
||||
@@ -250,7 +250,7 @@ class Reading < ActiveRecord::Base
|
||||
hour_diff[:total_kwh_produced_low],
|
||||
usage_kwh,
|
||||
return_kwh,
|
||||
@battery_kwh,
|
||||
@@battery_kwh,
|
||||
easy_usage_rate,
|
||||
easy_return_rate,
|
||||
easy_cost_with_battery,
|
||||
|
||||
Reference in New Issue
Block a user