Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Site < ActiveRecord::Base
- belongs_to :group
- belongs_to :status_sensor
- has_many :site_options
- has_many :status_changes
- def total_wet_time
- @site = site.find(params[:id])
- wet_time = 0
- for item in @site.status_changes |item|
- if KeyWord.get_in_wet_list(item.before) # checks is status==wet
- wet_time += item.duration # in seconds
- end
- end
- if KeyWord.get_in_wet_list(@site.sensor.last_value)
- wet_time += time_since(@site.sensor.last_page)
- end
- end
Add Comment
Please, Sign In to add comment