Sha256: 887a55e98a05e78314de6f805c2fa3a5496a2e2e22043e489e02e7e895d69984

Contents?: true

Size: 920 Bytes

Versions: 32

Compression:

Stored size: 920 Bytes

Contents

module ThinkFeelDoEngine
  # Simplifies the logic of the media/audio access event views.
  class MediaAccessEventPresenter
    attr_reader :event, :start_date

    def initialize(event:, start_date:)
      @event = event
      @start_date = start_date
    end

    def completed
      end_time
    end

    def available_on(group)
      relased_on(group)
        .to_s(:user_date)
    end

    def duration_of_session
      end_time - created_at
    end

    def formatted_end_time
      end_time.to_s(:standard)
    end

    def formatted_start_time
      created_at.to_s(:standard)
    end

    def sortable(group)
      relased_on(group).to_time.to_i
    end

    def title
      event.slide_title
    end

    private

    def created_at
      event.created_at
    end

    def relased_on(group)
      start_date + (event.task_release_day(group) - 1)
    end

    def end_time
      event.end_time
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
think_feel_do_engine-3.19.6 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.19.5 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.19.4 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.19.3 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.19.2 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.19.1 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.19.0 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.18.0 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.17.2 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.17.1 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.17.0 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.16.3 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.16.2 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.16.1 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.15.7 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.16.0 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.15.6 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.15.5 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.15.4 app/presenters/think_feel_do_engine/media_access_event_presenter.rb
think_feel_do_engine-3.15.3 app/presenters/think_feel_do_engine/media_access_event_presenter.rb