
class ContestingSoftapplication < ActiveRecord::Base
  attr_accessible :contest_id, :description, :softapplication_id, :user_id
  
  belongs_to :contest
  belongs_to :softapplication, :dependent => :destroy
  belongs_to :user
  
  
  def self.create_softapplication_contesting(contest_id, softapplication_id, description = nil)
    self.create(:user_id => User.current.id, :contest_id => contest_id,
                    :softapplication_id => softapplication_id, :description => description)
  end  
  
  def self.create_work_contesting(contest_id, softapplication_id)
    self.create(:user_id => User.current.id, :contest_id => contest_id,
                    :softapplication_id => softapplication_id)
  end  
  
  def update_reward(which)
    self.update_attribute(:reward,which)
  end
  
  def get_reward
    self.reward
  end  

end
