Sha256: fab0d11fe18ab1a465f7664e5b8b288d72532c915380bea99dede41aa26b6042

Contents?: true

Size: 859 Bytes

Versions: 110

Compression:

Stored size: 859 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/research"

module Renalware
  module Research
    class StudyParticipant < ApplicationRecord
      include Accountable
      include PatientsRansackHelper

      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

110 entries across 110 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/models/renalware/research/study_participant.rb
renalware-core-2.1.0 app/models/renalware/research/study_participant.rb
renalware-core-2.0.167 app/models/renalware/research/study_participant.rb
renalware-core-2.0.166 app/models/renalware/research/study_participant.rb
renalware-core-2.0.165 app/models/renalware/research/study_participant.rb
renalware-core-2.0.164 app/models/renalware/research/study_participant.rb
renalware-core-2.0.163 app/models/renalware/research/study_participant.rb
renalware-core-2.0.162 app/models/renalware/research/study_participant.rb
renalware-core-2.0.161 app/models/renalware/research/study_participant.rb
renalware-core-2.0.160 app/models/renalware/research/study_participant.rb
renalware-core-2.0.159 app/models/renalware/research/study_participant.rb
renalware-core-2.0.158 app/models/renalware/research/study_participant.rb
renalware-core-2.0.157 app/models/renalware/research/study_participant.rb
renalware-core-2.0.156 app/models/renalware/research/study_participant.rb
renalware-core-2.0.155 app/models/renalware/research/study_participant.rb
renalware-core-2.0.153 app/models/renalware/research/study_participant.rb
renalware-core-2.0.152 app/models/renalware/research/study_participant.rb
renalware-core-2.0.151 app/models/renalware/research/study_participant.rb
renalware-core-2.0.149 app/models/renalware/research/study_participant.rb
renalware-core-2.0.148 app/models/renalware/research/study_participant.rb