Sha256: b4af94b7c6f3bd2f047f5c508d0d11a39ae50fcda124561c01d55c796bd76403

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

class SprintTask < ActiveRecord::Base
  self.table_name = "sprints_tasks"
  
  belongs_to :sprint
  belongs_to :task
  belongs_to :checked_out_by, class_name: "User"
  
  def self.checked_out
    where arel_table[:checked_out_by_id].not_eq(nil)
  end
  
  def self.checked_out_by(user)
    where(checked_out_by_id: user.id)
  end
  
  def self.not_checked_out
    where(checked_out_by_id: nil)
  end
  
  def self.check_out!(user)
    update_all(checked_out_at: Time.now, checked_out_by_id: user.id)
  end
  
  def self.check_in!
    update_all(checked_out_at: nil, checked_out_by_id: nil)
  end
  
  def self.completed_during(sprint)
    all.merge(Task.unscoped.completed_during(sprint))
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
houston-core-0.5.0.beta1 app/models/sprint_task.rb