Sha256: 64eed3ac8bac0a97af584176b3f414971176cafab94be87cbd0c1d5438e4edf8

Contents?: true

Size: 713 Bytes

Versions: 5

Compression:

Stored size: 713 Bytes

Contents

require 'action_view'
module WoopleTheme
  module Dashboard
    class EssentialsSectionPresenter < SectionPresenter
      enforce_definitions :essentials_remaining,
                          :essentials_completed

      def render_remaining
        yield if render?(section.essentials_remaining)
      end

      def render_completed
        yield if render?(section.essentials_completed)
      end

      def total_completed_courses
        section.essentials_completed.count
      end

      def total_completed_minutes
        Duration.format_time(section.essentials_completed.map(&:time_total).inject(0, :+))
      end

      private

      def render?(tab)
        tab.count > 0
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
woople-theme-0.5.8 app/presenters/woople_theme/dashboard/essentials_section_presenter.rb
woople-theme-0.5.7 app/presenters/woople_theme/dashboard/essentials_section_presenter.rb
woople-theme-0.5.6 app/presenters/woople_theme/dashboard/essentials_section_presenter.rb
woople-theme-0.5.5 app/presenters/woople_theme/dashboard/essentials_section_presenter.rb
woople-theme-0.5.4 app/presenters/woople_theme/dashboard/essentials_section_presenter.rb