Sha256: d7bfb43c4ba4e81fee1da8ef66bbd931c24226594051344e3869c6ea0cb902e8

Contents?: true

Size: 731 Bytes

Versions: 55

Compression:

Stored size: 731 Bytes

Contents

module ThinkFeelDoEngine
  module Coach
    # Provides helpers for transforming patient data for the viz
    module MoodsAndPhqVizHelper
      def emotional_ratings(participant)
        ratings = {}
        participant.emotional_ratings.order(:created_at).each do |rating|
          unless ratings[rating.name.to_sym]
            ratings[rating.name.to_sym] = []
          end
          ratings[rating.name.to_sym] << [rating.created_at.to_i, rating.rating]
        end
        ratings.keys.map { |key| [key.to_sym, ratings[key.to_sym]] }
      end

      def mood_ratings(participant)
        participant.moods.order(:created_at).map do |mood|
          [mood.created_at.to_i, mood.rating]
        end
      end
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
think_feel_do_engine-3.19.9 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.19.8 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.19.7 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.19.6 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.19.5 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.19.4 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.19.3 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.19.2 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.19.1 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.19.0 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.18.0 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.17.2 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.17.1 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.17.0 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.16.3 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.16.2 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.16.1 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.15.7 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.16.0 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb
think_feel_do_engine-3.15.6 app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb