Sha256: 9ba3cfeb8efe5329846f3ea7321cba15dc51beedbd6bd07d5c34cf01c897517c

Contents?: true

Size: 821 Bytes

Versions: 17

Compression:

Stored size: 821 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/research"

module Renalware
  module Research
    class StudyParticipant < ApplicationRecord
      include Accountable
      acts_as_paranoid
      validates :participant_id, presence: true, uniqueness: { scope: :study }
      validates :study, presence: true
      validates :external_id, uniqueness: true # added by a trigger
      belongs_to :study, touch: true
      belongs_to :patient,
                 class_name: "Renalware::Patient",
                 foreign_key: :participant_id,
                 touch: true

      def to_s
        patient&.to_s
      end

      def external_application_participant_url
        return if study.application_url.blank?
        study.application_url.gsub("{external_id}", external_id.to_s)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
renalware-core-2.0.46 app/models/renalware/research/study_participant.rb
renalware-core-2.0.45 app/models/renalware/research/study_participant.rb
renalware-core-2.0.44 app/models/renalware/research/study_participant.rb
renalware-core-2.0.43 app/models/renalware/research/study_participant.rb
renalware-core-2.0.42 app/models/renalware/research/study_participant.rb
renalware-core-2.0.41 app/models/renalware/research/study_participant.rb
renalware-core-2.0.40 app/models/renalware/research/study_participant.rb
renalware-core-2.0.39 app/models/renalware/research/study_participant.rb
renalware-core-2.0.38 app/models/renalware/research/study_participant.rb
renalware-core-2.0.37 app/models/renalware/research/study_participant.rb
renalware-core-2.0.36 app/models/renalware/research/study_participant.rb
renalware-core-2.0.35 app/models/renalware/research/study_participant.rb
renalware-core-2.0.34 app/models/renalware/research/study_participant.rb
renalware-core-2.0.33 app/models/renalware/research/study_participant.rb
renalware-core-2.0.32 app/models/renalware/research/study_participant.rb
renalware-core-2.0.31 app/models/renalware/research/study_participant.rb
renalware-core-2.0.30 app/models/renalware/research/study_participant.rb