2021-01-07 15:45:02 +01:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: experts_procedures
|
|
|
|
#
|
|
|
|
# id :bigint not null, primary key
|
|
|
|
# allow_decision_access :boolean default(FALSE), not null
|
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
|
|
|
# expert_id :bigint not null
|
|
|
|
# procedure_id :bigint not null
|
|
|
|
#
|
|
|
|
class ExpertsProcedure < ApplicationRecord
|
|
|
|
belongs_to :expert
|
|
|
|
belongs_to :procedure
|
2021-01-15 16:39:07 +01:00
|
|
|
|
|
|
|
has_many :avis, dependent: :destroy
|
2021-01-25 13:02:22 +01:00
|
|
|
|
|
|
|
def email_to_display
|
|
|
|
expert&.email
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.invited_expert_emails(procedure)
|
|
|
|
joins(:expert)
|
|
|
|
.where(procedure: procedure)
|
|
|
|
.map(&:email_to_display)
|
|
|
|
.sort
|
|
|
|
end
|
2021-01-07 15:45:02 +01:00
|
|
|
end
|