Sha256: 7b16c5b8a15d542235cd29b5db1107363a880ede721cc818d7bf043870510436

Contents?: true

Size: 891 Bytes

Versions: 7

Compression:

Stored size: 891 Bytes

Contents

# frozen_string_literal: true
module ThinkFeelDoEngine
  module Reports
    # Collect metadata for all Participant Thoughts.
    class PatientThought
      def self.columns
        %w( participant_id content effect created_at pattern challenging_thought
            act_as_if )
      end

      def self.all
        Participant.not_moderator
                   .select(:id, :study_id).map.map do |participant|
          participant.thoughts.map do |thought|
            {
              participant_id: participant.study_id,
              content: thought.content,
              effect: thought.effect,
              created_at: thought.created_at.iso8601,
              pattern: thought.pattern.try(:title),
              challenging_thought: thought.challenging_thought,
              act_as_if: thought.act_as_if
            }
          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_thought.rb
think_feel_do_engine-3.22.8 app/models/think_feel_do_engine/reports/patient_thought.rb
think_feel_do_engine-3.22.7 app/models/think_feel_do_engine/reports/patient_thought.rb
think_feel_do_engine-3.22.6 app/models/think_feel_do_engine/reports/patient_thought.rb
think_feel_do_engine-3.22.5 app/models/think_feel_do_engine/reports/patient_thought.rb
think_feel_do_engine-3.22.4 app/models/think_feel_do_engine/reports/patient_thought.rb
think_feel_do_engine-3.22.2 app/models/think_feel_do_engine/reports/patient_thought.rb