Sha256: 42a914eb96657c59e54d2d0ad7d9acc982bcb421302fcb1f92282787b83412fb

Contents?: true

Size: 1.02 KB

Versions: 55

Compression:

Stored size: 1.02 KB

Contents

module ContentProviders
  # Provides a view of Activities that occured during a Participant"s most
  # recent AwakePeriod.
  class PastDueActivitiesViz < BitCore::ContentProvider
    def render_current(options, _ = nil)
      past_due = past_due_activities(options)
      upcoming = upcoming_activities(options)
      options.view_context.render(
        partial: "think_feel_do_engine/activities/" \
                 "past_due_activities_index_viz",
        locals: {
          past_due_count: past_due.count,
          upcoming_count: upcoming.count,
          past_due_activities: past_due.limit(4),
          upcoming_activities: upcoming.limit(4)
        }
      )
    end

    private

    def past_due_activities(options)
      options
        .participant
        .activities
        .in_the_past
        .planned
        .order(start_time: :desc)
    end

    def upcoming_activities(options)
      options
        .participant
        .activities
        .in_the_future
        .planned
        .order(start_time: :asc)
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

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