Class: ThinkFeelDoEngine::Reports::PatientThought

Inherits:
Object
  • Object
show all
Defined in:
app/models/think_feel_do_engine/reports/patient_thought.rb

Overview

Collect metadata for all Participant Thoughts.

Class Method Summary collapse

Class Method Details

.allObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/models/think_feel_do_engine/reports/patient_thought.rb', line 11

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

.columnsObject



6
7
8
9
# File 'app/models/think_feel_do_engine/reports/patient_thought.rb', line 6

def self.columns
  %w( participant_id content effect created_at pattern challenging_thought
      act_as_if )
end