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

@@ -77,8 +77,13 @@ class InSyncState < StatePattern::State
next_is_gas = true # the usage is on the next line
end
}
reading.save
last_reading = Reading.last
if last_reading.eql_reading?(reading)
p "Nothing changed. Do not add to the database"
else
reading.save
end
return reading
end