sis_core 1.0.12 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/sis/core/user_roles_controller.rb +11 -0
  3. data/app/controllers/sis/core/utils_controller.rb +19 -0
  4. data/app/models/sis/core/academic_calendar.rb +9 -0
  5. data/app/models/sis/core/academic_programme.rb +5 -1
  6. data/app/models/sis/core/academic_programme_document.rb +11 -0
  7. data/app/models/sis/core/academic_time_line.rb +14 -0
  8. data/app/models/sis/core/applicant.rb +2 -2
  9. data/app/models/sis/core/application.rb +2 -2
  10. data/app/models/sis/core/application_document.rb +1 -2
  11. data/app/models/sis/core/application_record.rb +4 -0
  12. data/app/models/sis/core/application_setup.rb +22 -3
  13. data/app/models/sis/core/building.rb +7 -0
  14. data/app/models/sis/core/class_schedule.rb +18 -0
  15. data/app/models/sis/core/class_time_table.rb +7 -0
  16. data/app/models/sis/core/classroom.rb +9 -0
  17. data/app/models/sis/core/course.rb +2 -4
  18. data/app/models/sis/core/course_assignment.rb +29 -0
  19. data/app/models/sis/core/course_offering.rb +19 -0
  20. data/app/models/sis/core/course_offering_sequence.rb +42 -0
  21. data/app/models/sis/core/course_registration.rb +12 -2
  22. data/app/models/sis/core/credit_hour_rate.rb +1 -0
  23. data/app/models/sis/core/curriculum.rb +17 -0
  24. data/app/models/sis/core/curriculum_course.rb +19 -0
  25. data/app/models/sis/core/document_requirement.rb +8 -1
  26. data/app/models/sis/core/document_type.rb +1 -0
  27. data/app/models/sis/core/eligibility_criteria.rb +10 -0
  28. data/app/models/sis/core/entry.rb +7 -0
  29. data/app/models/sis/core/exam_result.rb +0 -1
  30. data/app/models/sis/core/exam_setup.rb +3 -0
  31. data/app/models/sis/core/identification_pattern.rb +19 -0
  32. data/app/models/sis/core/instructor.rb +5 -0
  33. data/app/models/sis/core/level.rb +7 -0
  34. data/app/models/sis/core/prerequisite.rb +16 -0
  35. data/app/models/sis/core/programme.rb +1 -1
  36. data/app/models/sis/core/section.rb +9 -0
  37. data/app/models/sis/core/semester.rb +1 -5
  38. data/app/models/sis/core/student.rb +17 -1
  39. data/app/models/sis/core/student_document.rb +12 -0
  40. data/app/models/sis/core/student_eligibility.rb +16 -0
  41. data/app/serializers/sis/core/user_serializer.rb +4 -0
  42. data/app/services/sis/core/util_service.rb +16 -0
  43. data/config/routes.rb +2 -0
  44. data/db/migrate/20200105061717_create_sis_core_lookups.rb +3 -1
  45. data/db/migrate/20200105072142_create_sis_core_academic_years.rb +1 -1
  46. data/db/migrate/20200106072246_create_sis_core_semesters.rb +1 -5
  47. data/db/migrate/20200106132521_create_sis_core_application_setups.rb +4 -0
  48. data/db/migrate/20200106133034_create_sis_core_document_requirements.rb +2 -2
  49. data/db/migrate/20200107094449_create_sis_core_applications.rb +0 -4
  50. data/db/migrate/20201019055620_create_sis_core_academic_programme_documents.rb +19 -0
  51. data/db/migrate/20201102134749_create_sis_core_curriculums.rb +20 -0
  52. data/db/migrate/20201102182012_remove_programme_and_add_maximum_class_size_to_course.rb +10 -0
  53. data/db/migrate/20201102192055_create_sis_core_curriculum_courses.rb +17 -0
  54. data/db/migrate/20201104085458_create_sis_core_course_offering_sequences.rb +24 -0
  55. data/db/migrate/20201104111548_create_sis_core_course_offerings.rb +24 -0
  56. data/db/migrate/20201106091250_create_sis_core_prerequisites.rb +15 -0
  57. data/db/migrate/20201109064211_create_sis_core_buildings.rb +11 -0
  58. data/db/migrate/20201109070027_create_sis_core_classrooms.rb +21 -0
  59. data/db/migrate/20201109074944_create_sis_core_class_time_tables.rb +11 -0
  60. data/db/migrate/20201110075345_create_sis_core_sections.rb +13 -0
  61. data/db/migrate/20201110080957_create_sis_core_course_assignments.rb +22 -0
  62. data/db/migrate/20201110082516_create_sis_core_class_schedules.rb +22 -0
  63. data/db/migrate/20201130073930_create_sis_core_academic_calendars.rb +19 -0
  64. data/db/migrate/20201130080122_create_sis_core_academic_time_lines.rb +37 -0
  65. data/db/migrate/20201130091430_create_sis_core_eligibility_criteria.rb +13 -0
  66. data/db/migrate/20201130100442_add_fields_to_student.rb +79 -0
  67. data/db/migrate/20201130103634_create_sis_core_student_eligibilities.rb +29 -0
  68. data/db/migrate/20201201055256_add_course_offering_to_course_registration.rb +13 -0
  69. data/db/migrate/20201219073245_remove_full_name_from_instructor.rb +12 -0
  70. data/db/migrate/20201221100413_add_is_current_field_to_academic_year_and_semester.rb +7 -0
  71. data/db/migrate/20210113085806_create_sis_core_student_documents.rb +17 -0
  72. data/db/migrate/20210310071526_add_minimum_class_size_to_course.rb +6 -0
  73. data/db/migrate/20210429112550_create_active_storage_tables.active_storage.rb +37 -0
  74. data/db/migrate/20210429113938_rename_uploaded_fields.rb +6 -0
  75. data/db/migrate/20210504115132_create_sis_core_identification_patterns.rb +23 -0
  76. data/lib/sis/core/version.rb +1 -1
  77. data/lib/sis_core.rb +0 -1
  78. data/spec/factories/sis/core/academic_calendars.rb +9 -0
  79. data/spec/factories/sis/core/academic_programme_documents.rb +9 -0
  80. data/spec/factories/sis/core/academic_time_lines.rb +21 -0
  81. data/spec/factories/sis/core/academic_years.rb +1 -1
  82. data/spec/factories/sis/core/applicants.rb +1 -1
  83. data/spec/factories/sis/core/application_documents.rb +1 -1
  84. data/spec/factories/sis/core/application_setups.rb +1 -0
  85. data/spec/factories/sis/core/applications.rb +0 -1
  86. data/spec/factories/sis/core/buildings.rb +7 -0
  87. data/spec/factories/sis/core/class_schedules.rb +8 -0
  88. data/spec/factories/sis/core/class_time_tables.rb +7 -0
  89. data/spec/factories/sis/core/classrooms.rb +11 -0
  90. data/spec/factories/sis/core/course_assignments.rb +9 -0
  91. data/spec/factories/sis/core/course_offering_sequences.rb +8 -0
  92. data/spec/factories/sis/core/course_offerings.rb +8 -0
  93. data/spec/factories/sis/core/course_registrations.rb +3 -2
  94. data/spec/factories/sis/core/courses.rb +3 -1
  95. data/spec/factories/sis/core/curriculum_courses.rb +7 -0
  96. data/spec/factories/sis/core/curriculums.rb +10 -0
  97. data/spec/factories/sis/core/eligibility_criteria.rb +6 -0
  98. data/spec/factories/sis/core/entries.rb +5 -0
  99. data/spec/factories/sis/core/identification_patterns.rb +8 -0
  100. data/spec/factories/sis/core/instructor_courses.rb +2 -2
  101. data/spec/factories/sis/core/instructors.rb +3 -2
  102. data/spec/factories/sis/core/levels.rb +5 -0
  103. data/spec/factories/sis/core/lookups.rb +2 -0
  104. data/spec/factories/sis/core/prerequisites.rb +6 -0
  105. data/spec/factories/sis/core/sections.rb +6 -0
  106. data/spec/factories/sis/core/semesters.rb +1 -2
  107. data/spec/factories/sis/core/student_documents.rb +6 -0
  108. data/spec/factories/sis/core/student_eligibilities.rb +10 -0
  109. data/spec/factories/sis/core/students.rb +11 -5
  110. metadata +94 -54
  111. data/app/uploaders/sis/core/application_document_uploader.rb +0 -51
  112. data/app/uploaders/sis/core/photo_uploader.rb +0 -51
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a391a271ae5aa358a916776b0e2eedf3fc09cdb49e522627c81a5eefcdf6072
4
- data.tar.gz: 667e0483f0eb8dbac9d6bb81d2e7b98d3f59bb3244e3251f23010a921db5a8c7
3
+ metadata.gz: 0d8a574613ba77eb8db366949b723433df9c035de960d7d751f5969fcd7d4831
4
+ data.tar.gz: 3cddd57d65c9adae22464705f5ea560cc6b183674be4c2505056278c068e575e
5
5
  SHA512:
6
- metadata.gz: 8ac73e86b89644a285ddb1b45425daa0e809f80b0023f3dcbf091eec7344819ee51b22a2ff791268dad3ec701bf9307f4256dd6e483700f6f11ec10d1f99df59
7
- data.tar.gz: 4b9073797a0fc8317ba4f190678fba109444d8b1a0148383cbc7d5b694f61a56ffb39ba238bb1494bb5c2d10fc705cd3bb8dfbc0361616d6657a417095e16fde
6
+ metadata.gz: e29ee68bec9b045abe13f23813b7260a7ade6d61ade5edc385e1e9188872b37185bb7633e2c750b74757b2949ca01b148a6c0c63bb4c3ba9d9dda8579593a385
7
+ data.tar.gz: 1bf5e1c9957b2b6eaf00492d0c48b2fa1ce343280afcb07963a32e700d18181b743ee6f577c9766a07b4b794d54aacb84eefcdb62140bae0960ec5ff41ea63eb
@@ -0,0 +1,11 @@
1
+ module Sis
2
+ module Core
3
+ class UserRolesController < ApplicationController
4
+ skip_before_action :authenticate_request, only: %i[index]
5
+ def index
6
+ user_roles = UserRole.all
7
+ render json: { success: true, data: user_roles }
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,19 @@
1
+ module Sis
2
+ module Core
3
+ class UtilsController < ApplicationController
4
+ skip_before_action :authenticate_request, only: %i[filter]
5
+ before_action :set_util_service, only: %i[filter]
6
+
7
+ def filter
8
+ result = ApplicationRecord.serialize(@service.filter_record(params))
9
+ render json: { success: true, data: result }
10
+ end
11
+
12
+ private
13
+
14
+ def set_util_service
15
+ @service = UtilService.new
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ module Sis
2
+ module Core
3
+ class AcademicCalendar < ApplicationRecord
4
+ belongs_to :academic_year
5
+ belongs_to :semester
6
+ validates :start_date, :end_date, :event, presence: true
7
+ end
8
+ end
9
+ end
@@ -4,13 +4,17 @@ module Sis
4
4
  belongs_to :programme
5
5
  belongs_to :programme_type
6
6
  belongs_to :programme_level
7
+ has_many :academic_programme_documents
8
+
9
+ validates :programme_id, uniqueness: { scope: %i[programme_level_id programme_type_id],
10
+ message: 'Program has already been created !' }
7
11
 
8
12
  delegate(:name, to: :programme, prefix: true, allow_nil: false)
9
13
  delegate(:name, to: :programme_type, prefix: true, allow_nil: false)
10
14
  delegate(:name, to: :programme_level, prefix: true, allow_nil: false)
11
15
 
12
16
  def name
13
- programme.name.to_s + ' ' + programme_level.name.to_s + ' ' + programme_type.name.to_s
17
+ "#{programme.name} #{programme_level.name} #{programme_type.name}"
14
18
  end
15
19
  end
16
20
  end
@@ -0,0 +1,11 @@
1
+ module Sis
2
+ module Core
3
+ class AcademicProgrammeDocument < ApplicationRecord
4
+ belongs_to :academic_programme
5
+ belongs_to :document_type
6
+
7
+ delegate(:name, to: :academic_programme, prefix: true, allow_nil: false)
8
+ delegate(:name, to: :document_type, prefix: true, allow_nil: false)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ module Sis
2
+ module Core
3
+ class AcademicTimeLine < ApplicationRecord
4
+ belongs_to :academic_year
5
+ belongs_to :semester
6
+ belongs_to :programme_type
7
+ belongs_to :programme_level
8
+ validates :registration_start_date, :registration_end_date, :penalty_registration_start_date,
9
+ :penalty_registration_end_date, :add_and_drop_start_date, :add_and_drop_end_date,
10
+ :penalty_add_and_drop_start_date, :penalty_add_and_drop_end_date, :mid_exam_start_date,
11
+ :mid_exam_end_date, :final_exam_start_date, :final_exam_end_date, :grade_reporting_date, presence: true
12
+ end
13
+ end
14
+ end
@@ -1,16 +1,16 @@
1
1
  module Sis
2
2
  module Core
3
3
  class Applicant < ApplicationRecord
4
- mount_base64_uploader :photo, PhotoUploader
5
4
  validates :first_name, :middle_name, :last_name, :email, presence: true
6
5
  validates :email, uniqueness: true
7
6
 
8
7
  has_many :applications
8
+ has_one_attached :photo
9
9
 
10
10
  has_secure_password
11
11
 
12
12
  def full_name
13
- first_name + ' ' + middle_name + ' ' + last_name
13
+ "#{first_name} #{middle_name} #{last_name}"
14
14
  end
15
15
 
16
16
  scope :by_application_setup, (lambda do |app_setup_id|
@@ -49,12 +49,12 @@ module Sis
49
49
  validates :payment_information, presence: true, if: :payment_made
50
50
 
51
51
  belongs_to :applicant
52
- belongs_to :academic_programme
53
52
  belongs_to :application_setup
54
53
  has_many :application_documents
55
54
 
56
- delegate(:name, to: :academic_programme, prefix: true, allow_nil: false)
55
+ delegate(:name, to: :application_setup, prefix: true, allow_nil: false)
57
56
  delegate(:full_name, to: :applicant, prefix: true, allow_nil: false)
57
+ delegate(:academic_programme_id, to: :application_setup, prefix: false, allow_nil: false)
58
58
  end
59
59
  end
60
60
  end
@@ -1,10 +1,9 @@
1
1
  module Sis
2
2
  module Core
3
3
  class ApplicationDocument < ApplicationRecord
4
- mount_base64_uploader :document, ApplicationDocumentUploader
5
-
6
4
  belongs_to :application
7
5
  belongs_to :document_requirement
6
+ has_one_attached :document
8
7
 
9
8
  delegate(:name, to: :document_requirement, prefix: true, allow_nil: false)
10
9
  end
@@ -2,6 +2,10 @@ module Sis
2
2
  module Core
3
3
  class ApplicationRecord < ActiveRecord::Base
4
4
  self.abstract_class = true
5
+
6
+ def self.serialize(data)
7
+ ActiveModelSerializers::SerializableResource.new(data)
8
+ end
5
9
  end
6
10
  end
7
11
  end
@@ -6,18 +6,37 @@ module Sis
6
6
 
7
7
  belongs_to :academic_programme
8
8
  belongs_to :target_semester, class_name: 'Sis::Core::Semester'
9
+ belongs_to :academic_year
9
10
  has_many :document_requirements
10
11
  has_many :exam_setups
11
12
 
12
13
  validates :start_date, :end_date, :status, presence: true
13
14
  validates :status, inclusion: [OPEN, CLOSED]
15
+ validates :academic_programme_id, uniqueness: { scope: %i[target_semester_id academic_year_id],
16
+ message: 'Announcement has already been created for this academic
17
+ program !' }
14
18
 
15
- delegate(:name, to: :target_semester, prefix: true, allow_nil: false)
19
+ delegate(:code, to: :target_semester, prefix: true, allow_nil: false)
20
+ delegate(:year, to: :academic_year, prefix: false, allow_nil: false)
16
21
  delegate(:name, to: :academic_programme, prefix: true, allow_nil: false)
22
+ delegate(:programme_id, to: :academic_programme, prefix: false, allow_nil: false)
23
+ delegate(:programme_type_id, to: :academic_programme, prefix: false, allow_nil: false)
24
+ delegate(:programme_level_id, to: :academic_programme, prefix: false, allow_nil: false)
25
+ def programme_name
26
+ academic_programme.programme.name
27
+ end
28
+
29
+ def programme_type_name
30
+ academic_programme.programme_type.name
31
+ end
32
+
33
+ def programme_level_name
34
+ academic_programme.programme_level.name
35
+ end
17
36
 
18
37
  def name
19
- academic_programme.programme.name.to_s + ' ' + academic_programme.programme_level.name.to_s + ' ' +
20
- academic_programme.programme_type.name.to_s
38
+ "#{academic_programme.programme.name} #{academic_programme.programme_level.name}
39
+ #{academic_programme.programme_type.name}"
21
40
  end
22
41
  end
23
42
  end
@@ -0,0 +1,7 @@
1
+ module Sis
2
+ module Core
3
+ class Building < ApplicationRecord
4
+ validates :code, :name, :location, presence: true
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,18 @@
1
+ module Sis
2
+ module Core
3
+ class ClassSchedule < ApplicationRecord
4
+ belongs_to :classroom, optional: true
5
+ belongs_to :class_time_table, optional: true
6
+ belongs_to :course_assignment
7
+
8
+ delegate(:room_number, to: :classroom, prefix: true, allow_nil: true)
9
+ delegate(:name, to: :class_time_table, prefix: true, allow_nil: true)
10
+ delegate(:course_code, to: :course_assignment, prefix: false)
11
+ delegate(:course_title, to: :course_assignment, prefix: false)
12
+
13
+ def instructor_full_name
14
+ course_assignment.instructor.full_name
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ module Sis
2
+ module Core
3
+ class ClassTimeTable < ApplicationRecord
4
+ validates :name, :from, :to, presence: true
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ module Sis
2
+ module Core
3
+ class Classroom < ApplicationRecord
4
+ belongs_to :building
5
+ belongs_to :programme_level
6
+ validates :room_number, :floor, :class_type, presence: true
7
+ end
8
+ end
9
+ end
@@ -1,10 +1,8 @@
1
1
  module Sis
2
2
  module Core
3
3
  class Course < ApplicationRecord
4
- belongs_to :program
5
-
6
- validates :code, :title, :description, :credit_hours, :ects, :lecture_hours, :lab_hours, presence: true
7
- validates :code, uniqueness: true
4
+ validates :code, :title, :credit_hours, :ects, :lecture_hours, presence: true
5
+ validates :code, uniqueness: { case_sensitive: false }
8
6
  end
9
7
  end
10
8
  end
@@ -0,0 +1,29 @@
1
+ module Sis
2
+ module Core
3
+ class CourseAssignment < ApplicationRecord
4
+ belongs_to :course_offering
5
+ belongs_to :section
6
+ belongs_to :instructor
7
+ belongs_to :lab_instructor, class_name: 'Sis::Core::Instructor', optional: true
8
+ belongs_to :tutorial_instructor, class_name: 'Sis::Core::Instructor', optional: true
9
+
10
+ delegate(:course_code, to: :course_offering, prefix: false)
11
+ delegate(:course_title, to: :course_offering, prefix: false)
12
+ delegate(:course_ects, to: :course_offering, prefix: false)
13
+ delegate(:course_credit_hours, to: :course_offering, prefix: false)
14
+ delegate(:course_id, to: :course_offering, prefix: false)
15
+ delegate(:course_lecture_hours, to: :course_offering, prefix: false)
16
+ delegate(:course_lab_hours, to: :course_offering, prefix: false)
17
+ delegate(:course_tutorial_hours, to: :course_offering, prefix: false)
18
+ delegate(:first_name, to: :instructor, prefix: true, allow_nil: true)
19
+ delegate(:middle_name, to: :instructor, prefix: true, allow_nil: true)
20
+ delegate(:last_name, to: :instructor, prefix: true, allow_nil: true)
21
+ delegate(:first_name, to: :lab_instructor, prefix: true, allow_nil: true)
22
+ delegate(:middle_name, to: :lab_instructor, prefix: true, allow_nil: true)
23
+ delegate(:last_name, to: :lab_instructor, prefix: true, allow_nil: true)
24
+ delegate(:first_name, to: :tutorial_instructor, prefix: true, allow_nil: true)
25
+ delegate(:middle_name, to: :tutorial_instructor, prefix: true, allow_nil: true)
26
+ delegate(:last_name, to: :tutorial_instructor, prefix: true, allow_nil: true)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,19 @@
1
+ module Sis
2
+ module Core
3
+ class CourseOffering < ApplicationRecord
4
+ belongs_to :course_offering_sequence
5
+ belongs_to :academic_year
6
+ belongs_to :semester
7
+ belongs_to :level
8
+
9
+ delegate(:course_code, to: :course_offering_sequence, prefix: false)
10
+ delegate(:course_title, to: :course_offering_sequence, prefix: false)
11
+ delegate(:course_ects, to: :course_offering_sequence, prefix: false)
12
+ delegate(:course_credit_hours, to: :course_offering_sequence, prefix: false)
13
+ delegate(:course_id, to: :course_offering_sequence, prefix: false)
14
+ delegate(:course_lecture_hours, to: :course_offering_sequence, prefix: false)
15
+ delegate(:course_lab_hours, to: :course_offering_sequence, prefix: false)
16
+ delegate(:course_tutorial_hours, to: :course_offering_sequence, prefix: false)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,42 @@
1
+ module Sis
2
+ module Core
3
+ class CourseOfferingSequence < ApplicationRecord
4
+ belongs_to :curriculum_course
5
+ belongs_to :programme_type
6
+ belongs_to :level
7
+ belongs_to :semester
8
+
9
+ def course_id
10
+ curriculum_course.course.id.to_s
11
+ end
12
+
13
+ def course_code
14
+ curriculum_course.course.code.to_s
15
+ end
16
+
17
+ def course_title
18
+ curriculum_course.course.title.to_s
19
+ end
20
+
21
+ def course_ects
22
+ curriculum_course.course.ects.to_s
23
+ end
24
+
25
+ def course_credit_hours
26
+ curriculum_course.course.credit_hours.to_s
27
+ end
28
+
29
+ def course_lecture_hours
30
+ curriculum_course.course.lecture_hours.to_s
31
+ end
32
+
33
+ def course_lab_hours
34
+ curriculum_course.course.lab_hours.to_s
35
+ end
36
+
37
+ def course_tutorial_hours
38
+ curriculum_course.course.tutorial_hours.to_s
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,9 +1,19 @@
1
1
  module Sis
2
2
  module Core
3
3
  class CourseRegistration < ApplicationRecord
4
- belongs_to :course
4
+ belongs_to :course_offering
5
5
  belongs_to :student
6
- belongs_to :semester
6
+ belongs_to :section
7
+
8
+ delegate(:course_code, to: :course_offering, prefix: false)
9
+ delegate(:course_title, to: :course_offering, prefix: false)
10
+ delegate(:course_ects, to: :course_offering, prefix: false)
11
+ delegate(:course_credit_hours, to: :course_offering, prefix: false)
12
+ delegate(:first_name, to: :student, prefix: true)
13
+ delegate(:middle_name, to: :student, prefix: true)
14
+ delegate(:last_name, to: :student, prefix: true)
15
+ delegate(:name, to: :section, prefix: true)
16
+ delegate(:programme_level_id, to: :student, prefix: true)
7
17
  end
8
18
  end
9
19
  end
@@ -8,6 +8,7 @@ module Sis
8
8
 
9
9
  delegate(:name, to: :programme_level, prefix: true, allow_nil: false)
10
10
  delegate(:name, to: :currency, prefix: true, allow_nil: false)
11
+ delegate(:code, to: :currency, prefix: true, allow_nil: false)
11
12
  end
12
13
  end
13
14
  end
@@ -0,0 +1,17 @@
1
+ module Sis
2
+ module Core
3
+ class Curriculum < ApplicationRecord
4
+ belongs_to :programme
5
+ belongs_to :programme_level
6
+
7
+ validates :compulsory_course_credit_hours, :elective_course_credit_hours, :thesis_hour, :project_hour,
8
+ presence: true
9
+ delegate(:name, to: :programme, prefix: true)
10
+ delegate(:name, to: :programme_level, prefix: true)
11
+
12
+ def name
13
+ "#{programme.name} #{programme_level.name}"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ module Sis
2
+ module Core
3
+ class CurriculumCourse < ApplicationRecord
4
+ belongs_to :curriculum
5
+ belongs_to :course
6
+ validates :course_type, presence: true
7
+ has_many :predecessor_prerequisites, foreign_key: :successor_id, class_name: 'Prerequisite'
8
+ has_many :predecessors, through: :predecessor_prerequisites, source: :predecessor
9
+ has_many :successor_prerequisites, foreign_key: :predecessor_id, class_name: 'Prerequisite'
10
+ has_many :successors, through: :successor_prerequisites, source: :successor
11
+
12
+ delegate(:title, to: :course, prefix: true)
13
+ delegate(:code, to: :course, prefix: true)
14
+ delegate(:ects, to: :course, prefix: true)
15
+ delegate(:credit_hours, to: :course, prefix: true)
16
+ delegate(:name, to: :curriculum, prefix: true)
17
+ end
18
+ end
19
+ end
@@ -4,10 +4,17 @@ module Sis
4
4
  belongs_to :document_type
5
5
  belongs_to :application_setup
6
6
 
7
- validates :original, :copy, presence: true
7
+ validates :application_setup_id, uniqueness: { scope: :document_type_id,
8
+ message: 'Document has been already captured !' }
8
9
 
9
10
  delegate(:name, to: :document_type, prefix: true, allow_nil: false)
10
11
  delegate(:name, to: :application_setup, prefix: true, allow_nil: false)
12
+ delegate(:programme_id, to: :application_setup, prefix: false, allow_nil: false)
13
+ delegate(:programme_name, to: :application_setup, prefix: false, allow_nil: false)
14
+ delegate(:programme_level_id, to: :application_setup, prefix: false, allow_nil: false)
15
+ delegate(:programme_level_name, to: :application_setup, prefix: false, allow_nil: false)
16
+ delegate(:programme_type_id, to: :application_setup, prefix: false, allow_nil: false)
17
+ delegate(:programme_type_name, to: :application_setup, prefix: false, allow_nil: false)
11
18
  end
12
19
  end
13
20
  end