Sha256: f873a4766a8ed32f2718578fb5d1782c8f117149bccbb7ecfa05c77d1c9012d9

Contents?: true

Size: 1.5 KB

Versions: 11

Compression:

Stored size: 1.5 KB

Contents

# frozen_string_literal: true
module GroupMetrics
  # Tabulate count of Activities (within a study week) for a Group.
  class WeeklyActivitiesCount < WeeklyCount
    self.table_name = "activities"

    def self.fetch(group_id)
      super(group_id, "start_time")
    end

    scope :monitored, lambda {
      where(is_reviewed: false)
        .where
        .not(
          actual_accomplishment_intensity: nil,
          actual_pleasure_intensity: nil
        )
        .where(
          predicted_accomplishment_intensity: nil,
          predicted_pleasure_intensity: nil
        )
    }

    scope :planned, lambda {
      where(
        is_reviewed: false,
        actual_accomplishment_intensity: nil,
        actual_pleasure_intensity: nil
      )
        .where
        .not(
          predicted_accomplishment_intensity: nil,
          predicted_pleasure_intensity: nil
        )
    }

    scope :reviewed_and_complete, lambda {
      where(is_reviewed: true)
        .where
        .not(
          predicted_accomplishment_intensity: nil,
          predicted_pleasure_intensity: nil,
          actual_accomplishment_intensity: nil,
          actual_pleasure_intensity: nil
        )
    }

    scope :reviewed_and_incomplete, lambda {
      where(is_reviewed: true)
        .where(
          actual_accomplishment_intensity: nil,
          actual_pleasure_intensity: nil
        )
        .where
        .not(
          predicted_accomplishment_intensity: nil,
          predicted_pleasure_intensity: nil
        )
    }
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
think_feel_do_engine-3.22.9 app/models/group_metrics/weekly_activities_count.rb
think_feel_do_engine-3.22.8 app/models/group_metrics/weekly_activities_count.rb
think_feel_do_engine-3.22.7 app/models/group_metrics/weekly_activities_count.rb
think_feel_do_engine-3.22.6 app/models/group_metrics/weekly_activities_count.rb
think_feel_do_engine-3.22.5 app/models/group_metrics/weekly_activities_count.rb
think_feel_do_engine-3.22.4 app/models/group_metrics/weekly_activities_count.rb
think_feel_do_engine-3.22.2 app/models/group_metrics/weekly_activities_count.rb
think_feel_do_engine-3.22.1 app/models/group_metrics/weekly_activities_count.rb
think_feel_do_engine-3.22.0 app/models/group_metrics/weekly_activities_count.rb
think_feel_do_engine-3.21.2 app/models/group_metrics/weekly_activities_count.rb
think_feel_do_engine-3.21.1 app/models/group_metrics/weekly_activities_count.rb