class SportDb::Model::Play

Public Instance Methods

complete_rankings() click to toggle source

todo/fix: can it be done w/ a has_many macro and a condition?

# File lib/sportdb/play/models/play.rb, line 42
def complete_rankings  # fix rename to points and remove points column from play table??
  ## nb: removed .all() - check if still working; should - but never know
  recs = Point.where( pool_id: pool_id, user_id: user_id ).joins( :round ).order('rounds.pos')
  recs
end
export?() click to toggle source
# File lib/sportdb/play/models/play.rb, line 48
def export?
  # check if user entered some data
  # - do NOT export nil records (all teams blank)
  
  (team1_id.blank? && team2_id.blank? && team3_id.blank?)==false
end
job_done!() click to toggle source
# File lib/sportdb/play/models/play.rb, line 19
def job_done!()      @job_running = false;  end
job_running!() click to toggle source
# File lib/sportdb/play/models/play.rb, line 18
def job_running!()   @job_running = true;   end
job_running?() click to toggle source
# File lib/sportdb/play/models/play.rb, line 21
def job_running?
  (@job_running ||= false) == true
end
public?() click to toggle source
# File lib/sportdb/play/models/play.rb, line 25
def public?
  return true if pool.public?

  # team1, team2 public after kickoff of event
  ## use past?
  Time.now.utc > pool.event.start_at.utc
end
tips() click to toggle source

todo/fix: can it be done w/ a has_many macro and a condition?

# File lib/sportdb/play/models/play.rb, line 35
def tips
  ## nb: removed .all() - check if still working; should - but never know
  recs = Tip.where( pool_id: pool_id, user_id: user_id )
  recs
end