Class: SpreeCmCommissioner::VotingContestant
- Inherits:
-
Base
- Object
- Base
- SpreeCmCommissioner::VotingContestant
- Defined in:
- app/models/spree_cm_commissioner/voting_contestant.rb
Constant Summary collapse
- FIRESTORE_PUBLISHED_COLUMNS =
Republish the parent session's Firestore document whenever anything the show screen renders changes, so a reveal reaches every device without a pull-to-refresh.
%w[visible vote_number position eliminated].freeze
Instance Method Summary collapse
- #advanced_from_name ⇒ Object
- #advanced_to_name ⇒ Object
- #hide! ⇒ Object
-
#reveal! ⇒ Object
revealed_at records the first reveal and is left in place by #hide! — it is a broadcast audit trail ("when did this contestant go on screen"), not a mirror of
visible. - #special_rule_type ⇒ Object
- #special_rule_type=(value) ⇒ Object
Instance Method Details
#advanced_from_name ⇒ Object
78 79 80 |
# File 'app/models/spree_cm_commissioner/voting_contestant.rb', line 78 def advanced_from_name [advanced_from&.episode&.name, advanced_from&.name].compact.join(' - ') end |
#advanced_to_name ⇒ Object
82 83 84 |
# File 'app/models/spree_cm_commissioner/voting_contestant.rb', line 82 def advanced_to_name [advanced_to&.episode&.name || advanced_to_episode&.name, advanced_to&.name].compact.join(' - ') end |
#hide! ⇒ Object
74 75 76 |
# File 'app/models/spree_cm_commissioner/voting_contestant.rb', line 74 def hide! update!(visible: false) end |
#reveal! ⇒ Object
revealed_at records the first reveal and is left in place by #hide! — it is a broadcast
audit trail ("when did this contestant go on screen"), not a mirror of visible.
70 71 72 |
# File 'app/models/spree_cm_commissioner/voting_contestant.rb', line 70 def reveal! update!(visible: true, revealed_at: revealed_at || Time.current) end |
#special_rule_type ⇒ Object
64 65 66 |
# File 'app/models/spree_cm_commissioner/voting_contestant.rb', line 64 def special_rule_type (special_rules || {})['type'] end |
#special_rule_type=(value) ⇒ Object
60 61 62 |
# File 'app/models/spree_cm_commissioner/voting_contestant.rb', line 60 def special_rule_type=(value) self.special_rules = value.present? ? { 'type' => value } : {} end |