Class: SocialNetworking::Reports::Goal
- Inherits:
-
Object
- Object
- SocialNetworking::Reports::Goal
- Defined in:
- app/models/social_networking/reports/goal.rb
Overview
Scenario: a Participant has a Goal.
Class Method Summary collapse
-
.all ⇒ Object
rubocop:enable Metrics/LineLength.
-
.columns ⇒ Object
rubocop:disable Metrics/LineLength.
- .to_csv ⇒ Object
Class Method Details
.all ⇒ Object
rubocop:enable Metrics/LineLength
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/social_networking/reports/goal.rb', line 12 def self.all Participant.select(:id, :study_id).map do |participant| ::SocialNetworking::Goal .where(participant_id: participant.id).map do |goal| { participant_id: participant.study_id, created_at: goal.created_at.iso8601, due_on: goal.due_on ? goal.due_on.iso8601 : "", is_completed: goal.is_completed, is_deleted: goal.is_deleted, description: goal.description } end end.flatten end |
.columns ⇒ Object
rubocop:disable Metrics/LineLength
7 8 9 |
# File 'app/models/social_networking/reports/goal.rb', line 7 def self.columns %w( participant_id created_at due_on is_completed is_deleted description ) end |
.to_csv ⇒ Object
28 29 30 |
# File 'app/models/social_networking/reports/goal.rb', line 28 def self.to_csv ThinkFeelDoEngine::Reports::Reporter.new(self).write_csv end |