Class: Decidim::Votings::PollingOfficer

Inherits:
ApplicationRecord
  • Object
show all
Includes:
Loggable, Traceable
Defined in:
app/models/decidim/votings/polling_officer.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.for(user) ⇒ Object



44
45
46
# File 'app/models/decidim/votings/polling_officer.rb', line 44

def self.for(user)
  where(user: user)
end

.polling_officer?(user) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'app/models/decidim/votings/polling_officer.rb', line 40

def self.polling_officer?(user)
  exists?(user: user)
end

Instance Method Details

#polling_stationObject



55
56
57
# File 'app/models/decidim/votings/polling_officer.rb', line 55

def polling_station
  presided_polling_station || managed_polling_station
end

#roleObject



48
49
50
51
52
53
# File 'app/models/decidim/votings/polling_officer.rb', line 48

def role
  return :president if presided_polling_station.present?
  return :manager if managed_polling_station.present?

  :unassigned
end