Sha256: 3e40e5a8770d6a814028e4f03499349e3e76802a377d2faa2210accb292e0aa8

Contents?: true

Size: 1 KB

Versions: 11

Compression:

Stored size: 1 KB

Contents

module ThinkFeelDoEngine
  module Reports
    # Scenario: Participants complete a Phq Assessment by email.
    class PhqAssessment
      def self.columns
        %w( participant_id date_transmitted date_completed phq1 phq2 phq3 phq4
            phq5 phq6 phq7 phq8 phq9 )
      end

      def self.all
        Participant.not_moderator.select(:id, :study_id).map do |participant|
          participant.phq_assessments.map do |assessment|
            {
              participant_id: participant.study_id,
              date_transmitted: assessment.release_date.iso8601,
              date_completed: assessment.updated_at.to_date.iso8601,
              phq1: assessment.q1,
              phq2: assessment.q2,
              phq3: assessment.q3,
              phq4: assessment.q4,
              phq5: assessment.q5,
              phq6: assessment.q6,
              phq7: assessment.q7,
              phq8: assessment.q8,
              phq9: assessment.q9
            }
          end
        end.flatten
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
think_feel_do_engine-3.19.9 app/models/think_feel_do_engine/reports/phq_assessment.rb
think_feel_do_engine-3.19.8 app/models/think_feel_do_engine/reports/phq_assessment.rb
think_feel_do_engine-3.19.7 app/models/think_feel_do_engine/reports/phq_assessment.rb
think_feel_do_engine-3.19.6 app/models/think_feel_do_engine/reports/phq_assessment.rb
think_feel_do_engine-3.19.5 app/models/think_feel_do_engine/reports/phq_assessment.rb
think_feel_do_engine-3.19.4 app/models/think_feel_do_engine/reports/phq_assessment.rb
think_feel_do_engine-3.19.3 app/models/think_feel_do_engine/reports/phq_assessment.rb
think_feel_do_engine-3.19.2 app/models/think_feel_do_engine/reports/phq_assessment.rb
think_feel_do_engine-3.19.1 app/models/think_feel_do_engine/reports/phq_assessment.rb
think_feel_do_engine-3.19.0 app/models/think_feel_do_engine/reports/phq_assessment.rb
think_feel_do_engine-3.18.0 app/models/think_feel_do_engine/reports/phq_assessment.rb