reduce precision to 1 digit
This commit is contained in:
@@ -10,5 +10,25 @@ class Reading < ActiveRecord::Base
|
|||||||
self.total_m3_gas_consumed == reading.total_m3_gas_consumed &&
|
self.total_m3_gas_consumed == reading.total_m3_gas_consumed &&
|
||||||
self.high_tarif == reading.high_tarif
|
self.high_tarif == reading.high_tarif
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# reduce precision to 1 digit behind comma
|
||||||
|
def total_kwh_consumed_high=(kwh)
|
||||||
|
write_attribute(:total_kwh_consumed_high,kwh.round(1))
|
||||||
|
end
|
||||||
|
|
||||||
|
# reduce precision to 1 digit behind comma
|
||||||
|
def total_kwh_consumed_low=(kwh)
|
||||||
|
write_attribute(:total_kwh_consumed_low,kwh.round(1))
|
||||||
|
end
|
||||||
|
|
||||||
|
# reduce precision to 1 digit behind comma
|
||||||
|
def total_kwh_produced_high=(kwh)
|
||||||
|
write_attribute(:total_kwh_produced_high,kwh.round(1))
|
||||||
|
end
|
||||||
|
|
||||||
|
# reduce precision to 1 digit behind comma
|
||||||
|
def total_kwh_produced_low=(kwh)
|
||||||
|
write_attribute(:total_kwh_produced_low,kwh.round(1))
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user