Sha256: 35f44dcd8aadb3b69f3e0b544bd09864140d448d0e74a7ec39e379f1d9bfce87

Contents?: true

Size: 721 Bytes

Versions: 54

Compression:

Stored size: 721 Bytes

Contents

module Awardee
  def acquired_medals(organization=Organization.current)
    @acquired_medals ||= medals_for awarded_contents_in(organization)
  end

  def unacquired_medals(organization=Organization.current)
    @unacquired_medals ||= medals_for unawarded_contents_in(organization)
  end

  private

  def medals_for(content)
    content.map(&:medal)
  end

  def awarded_contents_in(organization)
    awardable_contents_in(organization).first
  end

  def unawarded_contents_in(organization)
    awardable_contents_in(organization).second
  end

  def awardable_contents_in(organization)
    @awardable_contents_in ||= organization.awardable_contents.partition { |c| c.once_completed_for? self, organization }
  end
end

Version data entries

54 entries across 54 versions & 2 rubygems

Version Path
mumuki-domain-9.23.0 app/models/concerns/awardee.rb
mumuki-domain-9.22.1 app/models/concerns/awardee.rb
mumuki-domain-9.22.0 app/models/concerns/awardee.rb
mumuki-domain-9.21.0 app/models/concerns/awardee.rb
mumuki-domain-9.20.0 app/models/concerns/awardee.rb
mumuki-domain-9.19.0 app/models/concerns/awardee.rb
mumuki-domain-9.18.0 app/models/concerns/awardee.rb
mumuki-domain-9.17.0 app/models/concerns/awardee.rb
mumuki-domain-9.16.0 app/models/concerns/awardee.rb
mumuki-domain-9.15.0 app/models/concerns/awardee.rb
mumuki-domain-9.14.1 app/models/concerns/awardee.rb
mumuki-domain-9.14.0 app/models/concerns/awardee.rb
mumuki-domain-9.13.1 app/models/concerns/awardee.rb
mumuki-domain-9.13.0 app/models/concerns/awardee.rb
mumuki-domain-9.12.0 app/models/concerns/awardee.rb
mumuki-domain-9.11.0 app/models/concerns/awardee.rb
mumuki-domain-9.10.0 app/models/concerns/awardee.rb
mumuki-domain-9.9.0 app/models/concerns/awardee.rb
mumuki-domain-9.8.1 app/models/concerns/awardee.rb
mumuki-domain-9.8.0 app/models/concerns/awardee.rb