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.8.1 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.8.0 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.6.27 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.6.26 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.6.25 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.6.24 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.6.23 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.6.22 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.6.21 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.6.20 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.6.19 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.6.18 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.6.17 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.6.14 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.6.13 app/presenters/woople_theme/dashboard/points_presenter.rb
woople-theme-0.6.12 app/presenters/woople_theme/dashboard/points_presenter.rb