Sha256: 8b5cfeccd32a5ac4b071342ab11c43310fe22f8fe326a3e19b3b9c8ffc8720db

Contents?: true

Size: 868 Bytes

Versions: 55

Compression:

Stored size: 868 Bytes

Contents

module ThinkFeelDoEngine
  module LessonEvent
    # Creates a presenter for the logic of the completion data partial
    class CompletionDataPresenter
      attr_reader :event, :lesson_module

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

      def last_page_number_opened
        event[:last_page_number_opened]
      end

      def last_page_opened_at
        DateTime.iso8601(event[:last_page_opened_at])
      end

      def page_headers
        event[:page_headers].try do |page_headers|
          page_headers[2]
        end
      end

      def pretty_title
        lesson.pretty_title
      end

      def selected_at
        DateTime.iso8601(event[:lesson_selected_at])
      end

      private

      def lesson
        lesson_module.find(event[:lesson_id])
      end
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

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