Skip to content
Snippets Groups Projects
Select Git revision
  • ccc90a8fdba69da7c035f95139711d24193bc024
  • master default protected
  • pw-autocomplete-off
  • redis-rate-limits
  • typehints
  • incremental-sync
  • test_instance_path
  • consistent_strings
  • qol_edits
  • v1.2.x
  • v1.x.x
  • v1.1.x
  • feature_invite_validuntil_minmax
  • Dockerfile
  • pylint_disable_consider-using-f-string
  • v1.0.x
  • roles-recursive-cte
  • v2.2.0
  • v2.1.0
  • v2.0.1
  • v2.0.0
  • v1.2.0
  • v1.1.2
  • v1.1.1
  • v1.0.2
  • v1.1.0
  • v1.0.1
  • v1.0.0
  • v0.3.0
  • v0.2.0
  • v0.1.5
  • v0.1.4
  • v0.1.2
33 results

pytest.ini

Blame
  • Forked from uffd / uffd
    Source project has a limited visibility.
    session.rb 1.13 KiB
    class Session < ApplicationRecord
      belongs_to :conference
      belongs_to :stage
      has_many :assignments
      has_many :users, through: :assignments
      has_many :session_speakers, dependent: :destroy
      has_many :speakers, through: :session_speakers
    
      scope :scheduled, -> { where(status: 'scheduled') }
      scope :future, -> { where(starts_at: Time.now..) }
    
      validates :ref_id, uniqueness: { scope: :conference_id }
    
      after_update :notify_if_changed
    
      self.implicit_order_column = :starts_at
    
      def to_param
        ref_id
      end
    
      def starts_at
        super.in_time_zone(conference.time_zone)
      end
    
      def ends_at
        super.in_time_zone(conference.time_zone)
      end
    
      def is_interpreted?
        is_relevant?
      end
    
      def is_relevant?
        RelevantStage.exists?(stage:)
      end
    
      def translators_needed?
        is_interpreted? && assignments.length < 2
      end
    
      def backup_needed?
        return false
      end
    
      def assignees?
        assignments.length.positive?
      end
    
      private
    
      def notify_if_changed
        return if new_record?
        if saved_changes.present?
          ActiveSupport::Notifications.instrument("session.updated", record: self, changes: saved_changes)
        end
      end
    end