Refactor to prepare for getting monthly overview
This commit is contained in:
@@ -25,6 +25,9 @@ class ReadingsMailer
|
||||
|
||||
# Fetch today's usage
|
||||
usage_today = Reading.diff_on(date)
|
||||
consumption_today, production_today = Reading.consumed_and_produced_for_diff(usage_today)
|
||||
|
||||
# Calculate costs for oxxio and easy energy
|
||||
c = Cost.new
|
||||
oxxio_cost = c.oxxio_energy_cost(date.to_s,usage_today[:total_kwh_consumed_high]-usage_today[:total_kwh_produced_high], usage_today[:total_kwh_consumed_low]-usage_today[:total_kwh_produced_low])
|
||||
easy_cost = c.easy_energy_cost_barplot(date) # side effect: generates a PNG
|
||||
@@ -41,8 +44,8 @@ class ReadingsMailer
|
||||
text_part do
|
||||
body "Summary for #{date}\n
|
||||
-------------------------------\n\n
|
||||
Total kWH electricity consumed: #{usage_today[:total_kwh_consumed_high] + usage_today[:total_kwh_consumed_low]}\n
|
||||
Total kWH electricity produced: #{usage_today[:total_kwh_produced_high] + usage_today[:total_kwh_produced_low]}\n
|
||||
Total kWH electricity consumed: #{consumption_today}\n
|
||||
Total kWH electricity produced: #{production_today}\n
|
||||
Total m3 gas consumed: #{usage_today[:total_m3_gas_consumed]}\n\n
|
||||
kWH cost (Oxxio): EUR #{ oxxio_cost }\n
|
||||
kWH cost (EasyEnergy): EUR #{ easy_cost }\n
|
||||
|
||||
Reference in New Issue
Block a user