prevent eql_readings to be saved to db.

This commit is contained in:
Aart van Halteren
2013-07-17 13:48:35 +02:00
parent 4b523f34a4
commit edfb27ab98
3 changed files with 19 additions and 3 deletions

View File

@@ -1,3 +1,14 @@
class Reading < ActiveRecord::Base
def eql_reading?(reading)
self.total_kwh_consumed_high == reading.total_kwh_consumed_high &&
self.total_kwh_consumed_low == reading.total_kwh_consumed_low &&
self.total_kwh_produced_high == reading.total_kwh_produced_high &&
self.total_kwh_produced_low == reading.total_kwh_produced_low &&
self.current_kw_consumed == reading.current_kw_consumed &&
self.current_kw_produced = reading.current_kw_produced &&
self.total_m3_gas_consumed = reading.total_m3_gas_consumed &&
self.high_tarif == reading.high_tarif
end
end