Class: Doodle::User::Analyst
- Inherits:
-
Doodle::User
- Object
- ActiveRecord::Base
- Doodle::User
- Doodle::User::Analyst
- Defined in:
- app/models/doodle/user/analyst.rb
Instance Method Summary collapse
- #break_limit_concurrent_protocols? ⇒ Boolean
- #enter_in_channel(channel_id) ⇒ Object
- #out_of_channel(name) ⇒ Object
- #user_channel_by_name(name) ⇒ Object
Methods inherited from Doodle::User
Instance Method Details
#break_limit_concurrent_protocols? ⇒ Boolean
18 19 20 |
# File 'app/models/doodle/user/analyst.rb', line 18 def break_limit_concurrent_protocols? self.protocols.where.not(status: 'finalized').count > self.concurrent_protocols end |
#enter_in_channel(channel_id) ⇒ Object
4 5 6 7 |
# File 'app/models/doodle/user/analyst.rb', line 4 def enter_in_channel(channel_id) user_channel = self.user_channels.where(channel_id: channel_id).first user_channel.turn_online! if user_channel.may_turn_online? end |
#out_of_channel(name) ⇒ Object
9 10 11 12 |
# File 'app/models/doodle/user/analyst.rb', line 9 def out_of_channel(name) user_channel = user_channel_by_name(name) user_channel.turn_offline! if user_channel.may_turn_offline? end |
#user_channel_by_name(name) ⇒ Object
14 15 16 |
# File 'app/models/doodle/user/analyst.rb', line 14 def user_channel_by_name(name) self.user_channels.joins(:channel).where('doodle_channels.name' => name).first end |