Class: Decidim::Votings::PollingOfficer

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.for(user) ⇒ Object


45
46
47
# File 'decidim-elections/app/models/decidim/votings/polling_officer.rb', line 45

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

.log_presenter_class_for(_log) ⇒ Object


60
61
62
# File 'decidim-elections/app/models/decidim/votings/polling_officer.rb', line 60

def self.log_presenter_class_for(_log)
  Decidim::Votings::AdminLog::PollingOfficerPresenter
end

.polling_officer?(user) ⇒ Boolean

Returns:

  • (Boolean)

41
42
43
# File 'decidim-elections/app/models/decidim/votings/polling_officer.rb', line 41

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

Instance Method Details

#polling_stationObject


56
57
58
# File 'decidim-elections/app/models/decidim/votings/polling_officer.rb', line 56

def polling_station
  presided_polling_station || managed_polling_station
end

#roleObject


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

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

  :unassigned
end