Sha256: 02db840e459f97a3d3f7967c883838f63e31c71aef06cf181fd82a173999fa68

Contents?: true

Size: 559 Bytes

Versions: 62

Compression:

Stored size: 559 Bytes

Contents

class Party < ActiveRecord::Base
  has_many :periods, :order => :position, :dependent => :destroy
  
  def to_sym
    self.class.name.downcase.to_sym
  end
  
  def controller
    self.class.name.downcase.pluralize
  end
  
  def icon
    to_sym.to_s + '.png'
  end
  
  def current_speed
    completed_periods = periods.select {|p| p.end_on < Date.today}
    if last_completed = completed_periods.last
      last_completed.speed
    elsif active_period = periods.to_ary.find {|p| p.active?}
      active_period.speed
    else
      0
    end
  end
  
  
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
backlog-0.36.2 app/models/party.rb
backlog-0.10.3 app/models/party.rb
backlog-0.10.4 app/models/party.rb
backlog-0.10.5 app/models/party.rb
backlog-0.10.7 app/models/party.rb
backlog-0.10.6 app/models/party.rb
backlog-0.10.8 app/models/party.rb
backlog-0.12.0 app/models/party.rb
backlog-0.11.0 app/models/party.rb
backlog-0.12.2 app/models/party.rb
backlog-0.12.1 app/models/party.rb
backlog-0.12.4 app/models/party.rb
backlog-0.12.3 app/models/party.rb
backlog-0.13.0 app/models/party.rb
backlog-0.13.1 app/models/party.rb
backlog-0.14.0 app/models/party.rb
backlog-0.14.1 app/models/party.rb
backlog-0.14.2 app/models/party.rb
backlog-0.14.3 app/models/party.rb
backlog-0.15.0 app/models/party.rb