Sha256: 0535deaa9e05d297e36a6db15ae7c78e4dbb6af08632d8a23d6d6d039477e188

Contents?: true

Size: 1.41 KB

Versions: 7

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true
module ThinkFeelDoEngine
  module Reports
    # Collect metadata for each Participant Activity.
    class PatientActivity
      def self.columns
        %w( participant_id activity_title created_at start_time end_time
            actual_accomplishment_intensity actual_pleasure_intensity
            predicted_accomplishment_intensity predicted_pleasure_intensity
            noncompliance_reason is_reviewed )
      end

      def self.all
        Participant.not_moderator.select(:id, :study_id).map do |participant|
          participant.activities.map do |activity|
            {
              participant_id: participant.study_id,
              activity_title: activity.title,
              created_at: activity.created_at.iso8601,
              start_time: activity.start_time,
              end_time: activity.end_time,
              actual_accomplishment_intensity:
                activity.actual_accomplishment_intensity,
              actual_pleasure_intensity: activity.actual_pleasure_intensity,
              predicted_accomplishment_intensity:
                activity.predicted_accomplishment_intensity,
              predicted_pleasure_intensity:
                activity.predicted_pleasure_intensity,
              noncompliance_reason: activity.noncompliance_reason,
              is_reviewed: activity.is_reviewed
            }
          end
        end.flatten
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
think_feel_do_engine-3.22.9 app/models/think_feel_do_engine/reports/patient_activity.rb
think_feel_do_engine-3.22.8 app/models/think_feel_do_engine/reports/patient_activity.rb
think_feel_do_engine-3.22.7 app/models/think_feel_do_engine/reports/patient_activity.rb
think_feel_do_engine-3.22.6 app/models/think_feel_do_engine/reports/patient_activity.rb
think_feel_do_engine-3.22.5 app/models/think_feel_do_engine/reports/patient_activity.rb
think_feel_do_engine-3.22.4 app/models/think_feel_do_engine/reports/patient_activity.rb
think_feel_do_engine-3.22.2 app/models/think_feel_do_engine/reports/patient_activity.rb