Class: ThinkFeelDoEngine::Reports::MoodRating

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

Overview

Collect metadata for all Participant Mood Ratings.

Class Method Summary collapse

Class Method Details

.allObject



10
11
12
13
14
15
16
17
18
19
20
# File 'app/models/think_feel_do_engine/reports/mood_rating.rb', line 10

def self.all
  Participant.not_moderator.select(:id, :study_id).map do |participant|
    participant.moods.map do |mood|
      {
        participant_id: participant.study_id,
        rating: mood.rating,
        created_at: mood.created_at.iso8601
      }
    end
  end.flatten
end

.columnsObject



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

def self.columns
  %w( participant_id rating created_at )
end