Created
June 14, 2016 10:26
-
-
Save Stanislav-Lapata/1a99804c97b11ca17ffab228789415aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def update_obd_device_odometer(trip) | |
if trip.summary.odo && trip.summary.odo > 0 | |
vehicle = Vehicle.find_by(id: trip.vehicle.id) | |
if vehicle.obd_device_odometer && vehicle.obd_device_odometer < trip.summary.odo | |
vehicle.update_attributes(obd_device_odometer: trip.summary.odo) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment