Sha256: 0f466a23160ffc77116522f3371db4966fd2a4872a90e3ce128c91592552623a

Contents?: true

Size: 781 Bytes

Versions: 3

Compression:

Stored size: 781 Bytes

Contents

module Sis
  module Core
    class ApplicationSetup < ApplicationRecord
      OPEN = 'Open'.freeze
      CLOSED = 'Closed'.freeze

      belongs_to :academic_programme
      belongs_to :target_semester, class_name: 'Sis::Core::Semester'
      has_many :document_requirements
      has_many :exam_setups

      validates :start_date, :end_date, :status, presence: true
      validates :status, inclusion: [OPEN, CLOSED]

      delegate(:name, to: :target_semester, prefix: true, allow_nil: false)
      delegate(:name, to: :academic_programme, prefix: true, allow_nil: false)

      def name
        academic_programme.programme.name.to_s + ' ' + academic_programme.programme_level.name.to_s + ' ' +
          academic_programme.programme_type.name.to_s
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sis_core-1.0.12 app/models/sis/core/application_setup.rb
sis_core-1.0.11 app/models/sis/core/application_setup.rb
sis_core-1.0.10 app/models/sis/core/application_setup.rb