Class: SportDb::Models::Play
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- SportDb::Models::Play
- Defined in:
- lib/sportdb/play/models/play.rb
Instance Method Summary collapse
-
#complete_rankings ⇒ Object
todo/fix: can it be done w/ a has_many macro and a condition?.
- #export? ⇒ Boolean
- #job_done! ⇒ Object
- #job_running! ⇒ Object
- #job_running? ⇒ Boolean
- #public? ⇒ Boolean
-
#tips ⇒ Object
todo/fix: can it be done w/ a has_many macro and a condition?.
Instance Method Details
#complete_rankings ⇒ Object
todo/fix: can it be done w/ a has_many macro and a condition?
45 46 47 48 49 |
# File 'lib/sportdb/play/models/play.rb', line 45 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? ⇒ Boolean
51 52 53 54 55 56 |
# File 'lib/sportdb/play/models/play.rb', line 51 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! ⇒ Object
20 21 22 |
# File 'lib/sportdb/play/models/play.rb', line 20 def job_done! @job_running = false end |
#job_running! ⇒ Object
16 17 18 |
# File 'lib/sportdb/play/models/play.rb', line 16 def job_running! @job_running = true end |
#job_running? ⇒ Boolean
24 25 26 |
# File 'lib/sportdb/play/models/play.rb', line 24 def job_running? (@job_running ||= false) == true end |
#public? ⇒ Boolean
28 29 30 31 32 33 34 |
# File 'lib/sportdb/play/models/play.rb', line 28 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 ⇒ Object
todo/fix: can it be done w/ a has_many macro and a condition?
38 39 40 41 42 |
# File 'lib/sportdb/play/models/play.rb', line 38 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 |