Sha256: ad240dfd10b31110183026a5001ed7c4369d74b33f4c9082e63b265e39ba342e

Contents?: true

Size: 774 Bytes

Versions: 4

Compression:

Stored size: 774 Bytes

Contents

# frozen_string_literal: true
module SocialNetworking
  module Reports
    # Scenario: a Participant nudges another Participant.
    class Nudge
      def self.columns
        %w( participant_id occurred_at recipient_id )
      end

      def self.all
        Participant.select(:id, :study_id).map do |participant|
          ::SocialNetworking::Nudge
            .where(initiator_id: participant.id).map do |nudge|
              {
                participant_id: participant.study_id,
                occurred_at: nudge.created_at.iso8601,
                recipient_id: nudge.recipient.study_id
              }
            end
        end.flatten
      end

      def self.to_csv
        ThinkFeelDoEngine::Reports::Reporter.new(self).write_csv
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
social_networking-0.13.2 app/models/social_networking/reports/nudge.rb
social_networking-0.13.1 app/models/social_networking/reports/nudge.rb
social_networking-0.13.0 app/models/social_networking/reports/nudge.rb
social_networking-0.12.0 app/models/social_networking/reports/nudge.rb