Sha256: 6c87c0dd9e767f38148e87f0657c5719226a96d53ee74356af5cb2d7e8495d79
Contents?: true
Size: 1.66 KB
Versions: 4
Compression:
Stored size: 1.66 KB
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' belongs_to :academic_year has_many :document_requirements has_many :exam_setups validates :start_date, :end_date, :status, presence: true validates :status, inclusion: [OPEN, CLOSED] validates :academic_programme_id, uniqueness: { scope: %i[target_semester_id academic_year_id], message: 'Announcement has already been created for this academic program !' } delegate(:code, to: :target_semester, prefix: true, allow_nil: false) delegate(:year, to: :academic_year, prefix: false, allow_nil: false) delegate(:name, to: :academic_programme, prefix: true, allow_nil: false) delegate(:programme_id, to: :academic_programme, prefix: false, allow_nil: false) delegate(:programme_type_id, to: :academic_programme, prefix: false, allow_nil: false) delegate(:programme_level_id, to: :academic_programme, prefix: false, allow_nil: false) def programme_name academic_programme.programme.name end def programme_type_name academic_programme.programme_type.name end def programme_level_name academic_programme.programme_level.name end def name "#{academic_programme.programme.name} #{academic_programme.programme_level.name} #{academic_programme.programme_type.name}" end end end end
Version data entries
4 entries across 4 versions & 1 rubygems