Sha256: b57cc667818671d09f3a1335298c80b6413400ef1956f8f22aeef546c80ec6e4

Contents?: true

Size: 372 Bytes

Versions: 36

Compression:

Stored size: 372 Bytes

Contents

require 'explicit_delegator'

module WoopleTheme
  module Dashboard
    class PointsPresenter < ExplicitDelegator
      enforce_definitions :earned, :total

      def percent_complete
        return 100 if data.total.zero?

        ( (data.earned.to_f / data.total.to_f) * 100 ).round
      end

      private

      def data
        @delegate
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
woople-theme-0.10.0 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.9.0 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.19 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.18 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.17 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.16 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.15 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.14 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.13 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.12 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.11 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.10 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.9 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.8 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.7 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.6 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.5 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.4 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.3 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.2 app/presenters/woople_theme/dashboard/points_presenter.rb