sis_core 1.0.14 → 1.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) 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 +2 -2
  6. data/app/models/sis/core/academic_time_line.rb +14 -0
  7. data/app/models/sis/core/applicant.rb +2 -2
  8. data/app/models/sis/core/application_document.rb +1 -2
  9. data/app/models/sis/core/application_record.rb +4 -0
  10. data/app/models/sis/core/application_setup.rb +2 -2
  11. data/app/models/sis/core/building.rb +7 -0
  12. data/app/models/sis/core/class_schedule.rb +18 -0
  13. data/app/models/sis/core/class_time_table.rb +7 -0
  14. data/app/models/sis/core/classroom.rb +9 -0
  15. data/app/models/sis/core/course.rb +2 -4
  16. data/app/models/sis/core/course_assignment.rb +41 -0
  17. data/app/models/sis/core/course_offering.rb +19 -0
  18. data/app/models/sis/core/course_offering_sequence.rb +42 -0
  19. data/app/models/sis/core/course_registration.rb +12 -2
  20. data/app/models/sis/core/credit_hour_rate.rb +1 -0
  21. data/app/models/sis/core/curriculum.rb +17 -0
  22. data/app/models/sis/core/curriculum_course.rb +19 -0
  23. data/app/models/sis/core/document_type.rb +0 -1
  24. data/app/models/sis/core/eligibility_criteria.rb +10 -0
  25. data/app/models/sis/core/entry.rb +7 -0
  26. data/app/models/sis/core/exam_result.rb +0 -1
  27. data/app/models/sis/core/identification_pattern.rb +19 -0
  28. data/app/models/sis/core/instructor.rb +5 -0
  29. data/app/models/sis/core/level.rb +7 -0
  30. data/app/models/sis/core/prerequisite.rb +16 -0
  31. data/app/models/sis/core/section.rb +9 -0
  32. data/app/models/sis/core/student.rb +17 -1
  33. data/app/models/sis/core/student_document.rb +12 -0
  34. data/app/models/sis/core/student_eligibility.rb +16 -0
  35. data/app/serializers/sis/core/user_serializer.rb +8 -0
  36. data/app/services/sis/core/util_service.rb +16 -0
  37. data/config/routes.rb +2 -0
  38. data/db/migrate/20201102134749_create_sis_core_curriculums.rb +20 -0
  39. data/db/migrate/20201102182012_remove_programme_and_add_maximum_class_size_to_course.rb +10 -0
  40. data/db/migrate/20201102192055_create_sis_core_curriculum_courses.rb +17 -0
  41. data/db/migrate/20201104085458_create_sis_core_course_offering_sequences.rb +24 -0
  42. data/db/migrate/20201104111548_create_sis_core_course_offerings.rb +24 -0
  43. data/db/migrate/20201106091250_create_sis_core_prerequisites.rb +15 -0
  44. data/db/migrate/20201109064211_create_sis_core_buildings.rb +11 -0
  45. data/db/migrate/20201109070027_create_sis_core_classrooms.rb +21 -0
  46. data/db/migrate/20201109074944_create_sis_core_class_time_tables.rb +11 -0
  47. data/db/migrate/20201110075345_create_sis_core_sections.rb +13 -0
  48. data/db/migrate/20201110080957_create_sis_core_course_assignments.rb +22 -0
  49. data/db/migrate/20201110082516_create_sis_core_class_schedules.rb +22 -0
  50. data/db/migrate/20201130073930_create_sis_core_academic_calendars.rb +19 -0
  51. data/db/migrate/20201130080122_create_sis_core_academic_time_lines.rb +37 -0
  52. data/db/migrate/20201130091430_create_sis_core_eligibility_criteria.rb +13 -0
  53. data/db/migrate/20201130100442_add_fields_to_student.rb +82 -0
  54. data/db/migrate/20201130103634_create_sis_core_student_eligibilities.rb +29 -0
  55. data/db/migrate/20201201055256_add_course_offering_to_course_registration.rb +13 -0
  56. data/db/migrate/20201219073245_remove_full_name_from_instructor.rb +12 -0
  57. data/db/migrate/20201221100413_add_is_current_field_to_academic_year_and_semester.rb +7 -0
  58. data/db/migrate/20210113085806_create_sis_core_student_documents.rb +17 -0
  59. data/db/migrate/20210310071526_add_minimum_class_size_to_course.rb +6 -0
  60. data/db/migrate/20210429112550_create_active_storage_tables.active_storage.rb +37 -0
  61. data/db/migrate/20210429113938_rename_uploaded_fields.rb +6 -0
  62. data/db/migrate/20210504115132_create_sis_core_identification_patterns.rb +23 -0
  63. data/db/migrate/20210513080708_add_unique_index_to_models.rb +8 -0
  64. data/lib/sis/core/version.rb +1 -1
  65. data/lib/sis_core.rb +0 -1
  66. data/spec/factories/sis/core/academic_calendars.rb +9 -0
  67. data/spec/factories/sis/core/academic_time_lines.rb +21 -0
  68. data/spec/factories/sis/core/applicants.rb +1 -1
  69. data/spec/factories/sis/core/application_documents.rb +1 -1
  70. data/spec/factories/sis/core/buildings.rb +7 -0
  71. data/spec/factories/sis/core/class_schedules.rb +8 -0
  72. data/spec/factories/sis/core/class_time_tables.rb +7 -0
  73. data/spec/factories/sis/core/classrooms.rb +11 -0
  74. data/spec/factories/sis/core/course_assignments.rb +9 -0
  75. data/spec/factories/sis/core/course_offering_sequences.rb +8 -0
  76. data/spec/factories/sis/core/course_offerings.rb +8 -0
  77. data/spec/factories/sis/core/course_registrations.rb +3 -2
  78. data/spec/factories/sis/core/courses.rb +3 -1
  79. data/spec/factories/sis/core/curriculum_courses.rb +7 -0
  80. data/spec/factories/sis/core/eligibility_criteria.rb +6 -0
  81. data/spec/factories/sis/core/entries.rb +5 -0
  82. data/spec/factories/sis/core/identification_patterns.rb +8 -0
  83. data/spec/factories/sis/core/instructor_courses.rb +2 -2
  84. data/spec/factories/sis/core/instructors.rb +3 -2
  85. data/spec/factories/sis/core/levels.rb +5 -0
  86. data/spec/factories/sis/core/prerequisites.rb +6 -0
  87. data/spec/factories/sis/core/sections.rb +6 -0
  88. data/spec/factories/sis/core/student_documents.rb +6 -0
  89. data/spec/factories/sis/core/student_eligibilities.rb +10 -0
  90. data/spec/factories/sis/core/students.rb +11 -5
  91. metadata +91 -54
  92. data/app/uploaders/sis/core/application_document_uploader.rb +0 -51
  93. data/app/uploaders/sis/core/photo_uploader.rb +0 -51
@@ -1,6 +1,11 @@
1
1
  module Sis
2
2
  module Core
3
3
  class Instructor < ApplicationRecord
4
+ belongs_to :user
5
+
6
+ def full_name
7
+ "#{first_name} #{middle_name} #{last_name}"
8
+ end
4
9
  end
5
10
  end
6
11
  end
@@ -0,0 +1,7 @@
1
+ module Sis
2
+ module Core
3
+ class Level < Lookup
4
+ validates :code, :name, presence: true
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ module Sis
2
+ module Core
3
+ class Prerequisite < ApplicationRecord
4
+ belongs_to :predecessor, foreign_key: 'predecessor_id', class_name: 'CurriculumCourse'
5
+ belongs_to :successor, foreign_key: 'successor_id', class_name: 'CurriculumCourse'
6
+
7
+ def predecessor_name
8
+ predecessor.course.title.to_s
9
+ end
10
+
11
+ def successor_name
12
+ successor.course.name.to_s
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ module Sis
2
+ module Core
3
+ class Section < ApplicationRecord
4
+ belongs_to :entry
5
+ validates :name, presence: true
6
+ validates :name, uniqueness: { scope: %i[entry_id] }
7
+ end
8
+ end
9
+ end
@@ -1,7 +1,23 @@
1
1
  module Sis
2
2
  module Core
3
3
  class Student < ApplicationRecord
4
- belongs_to :program
4
+ has_one_attached :picture
5
+ belongs_to :user
6
+ belongs_to :level, optional: true
7
+ belongs_to :semester, optional: true
8
+ belongs_to :entry, optional: true
9
+ belongs_to :programme
10
+ belongs_to :programme_level
11
+ belongs_to :programme_type
12
+ belongs_to :advisor, class_name: 'Sis::Core::Instructor', optional: true
13
+ has_many :course_registrations
14
+
15
+ delegate(:first_name, to: :user, prefix: false)
16
+ delegate(:last_name, to: :user, prefix: false)
17
+ delegate(:email, to: :user, prefix: false)
18
+ delegate(:first_name, to: :advisor, prefix: true, allow_nil: true)
19
+ delegate(:middle_name, to: :advisor, prefix: true, allow_nil: true)
20
+ delegate(:last_name, to: :advisor, prefix: true, allow_nil: true)
5
21
  end
6
22
  end
7
23
  end
@@ -0,0 +1,12 @@
1
+ module Sis
2
+ module Core
3
+ class StudentDocument < ApplicationRecord
4
+ has_one_attached :file
5
+ belongs_to :document_type, optional: true
6
+ belongs_to :student
7
+
8
+ delegate(:code, to: :document_type, prefix: true, allow_nil: true)
9
+ delegate(:name, to: :document_type, prefix: true)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ module Sis
2
+ module Core
3
+ class StudentEligibility < ApplicationRecord
4
+ belongs_to :student
5
+ belongs_to :academic_year
6
+ belongs_to :semester
7
+ belongs_to :eligibility_criteria
8
+ belongs_to :cleared_by, class_name: 'Sis::Core::User'
9
+
10
+ delegate(:first_name, to: :student, prefix: true)
11
+ delegate(:middle_name, to: :student, prefix: true)
12
+ delegate(:last_name, to: :student, prefix: true)
13
+ delegate(:description, to: :eligibility_criteria, prefix: true)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,8 @@
1
+ module Sis
2
+ module Core
3
+ class UserSerializer < ActiveModel::Serializer
4
+ attributes :id, :first_name, :last_name, :email, :active
5
+ has_many :user_roles
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,16 @@
1
+ module Sis
2
+ module Core
3
+ class UtilService
4
+ def filter_record(params)
5
+ pos = {}
6
+ neg = {}
7
+
8
+ filter = params[:filter] || []
9
+ filter.each do |f|
10
+ f[:cond] == 'P' ? pos[f[:key]] = f[:value] : neg[f[:key]] = f[:value]
11
+ end
12
+ params[:entity].constantize.where(pos).where.not(neg)
13
+ end
14
+ end
15
+ end
16
+ end
data/config/routes.rb CHANGED
@@ -5,4 +5,6 @@ Sis::Core::Engine.routes.draw do
5
5
  post '/sign_in', controller: :users, action: :sign_in
6
6
  post '/generate_recovery_token', controller: :users, action: :generate_recovery_token
7
7
  post '/reset_password', controller: :users, action: :reset_password
8
+ resources :user_roles, only: %i[index]
9
+ post '/utils/filter', controller: :utils, action: :filter
8
10
  end
@@ -0,0 +1,20 @@
1
+ class CreateSisCoreCurriculums < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_curriculums do |t|
4
+ t.references :programme,
5
+ null: false,
6
+ index: { name: 'pr_on_curriculum_indx' },
7
+ foreign_key: { to_table: :sis_core_programmes }
8
+ t.references :programme_level,
9
+ null: false,
10
+ index: { name: 'pr_level_on_curriculum_indx' },
11
+ foreign_key: { to_table: :sis_core_lookups }
12
+ t.float :compulsory_course_credit_hours, null: false
13
+ t.float :elective_course_credit_hours, null: false
14
+ t.float :thesis_hour, null: false
15
+ t.float :project_hour, null: false
16
+
17
+ t.timestamps
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,10 @@
1
+ class RemoveProgrammeAndAddMaximumClassSizeToCourse < ActiveRecord::Migration[6.0]
2
+ def change
3
+ remove_column :sis_core_courses, :academic_programme_id
4
+ add_column :sis_core_courses, :maximum_class_size, :integer
5
+ add_column :sis_core_courses, :has_lab, :boolean, default: false
6
+ add_column :sis_core_courses, :has_tutorial, :boolean, default: false
7
+ add_column :sis_core_courses, :tutorial_hours, :float
8
+ change_column :sis_core_courses, :description, :string, null: true
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ class CreateSisCoreCurriculumCourses < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_curriculum_courses do |t|
4
+ t.references :curriculum,
5
+ null: false,
6
+ index: { name: 'cc_on_cc_course_indx' },
7
+ foreign_key: { to_table: :sis_core_curriculums }
8
+ t.references :course,
9
+ null: false,
10
+ index: { name: 'course_on_cc_course_indx' },
11
+ foreign_key: { to_table: :sis_core_courses }
12
+ t.string :course_type
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,24 @@
1
+ class CreateSisCoreCourseOfferingSequences < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_course_offering_sequences do |t|
4
+ t.references :curriculum_course,
5
+ null: false,
6
+ index: { name: 'cc_on_course_off_seq' },
7
+ foreign_key: { to_table: :sis_core_curriculum_courses }
8
+ t.references :programme_type,
9
+ null: false,
10
+ index: { name: 'pt_on_course_off_seq' },
11
+ foreign_key: { to_table: :sis_core_lookups }
12
+ t.references :level,
13
+ null: false,
14
+ index: { name: 'level_on_course_off_seq' },
15
+ foreign_key: { to_table: :sis_core_lookups }
16
+ t.references :semester,
17
+ null: false,
18
+ index: { name: 'sem_on_course_off_seq' },
19
+ foreign_key: { to_table: :sis_core_semesters }
20
+
21
+ t.timestamps
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ class CreateSisCoreCourseOfferings < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_course_offerings do |t|
4
+ t.references :course_offering_sequence,
5
+ null: false,
6
+ index: { name: 'crs_off_seq_on_crs_off' },
7
+ foreign_key: { to_table: :sis_core_course_offering_sequences }
8
+ t.references :academic_year,
9
+ null: false,
10
+ index: { name: 'ay_on_crs_off' },
11
+ foreign_key: { to_table: :sis_core_academic_years }
12
+ t.references :semester,
13
+ null: false,
14
+ index: { name: 'sem_on_crs_off' },
15
+ foreign_key: { to_table: :sis_core_semesters }
16
+ t.references :level,
17
+ null: false,
18
+ index: { name: 'level_on_crs_off' },
19
+ foreign_key: { to_table: :sis_core_lookups }
20
+
21
+ t.timestamps
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,15 @@
1
+ class CreateSisCorePrerequisites < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_prerequisites do |t|
4
+ t.references :predecessor,
5
+ null: false,
6
+ index: { name: 'pred_on_prerequisite' },
7
+ foreign_key: { to_table: :sis_core_curriculum_courses }
8
+ t.references :successor,
9
+ null: false,
10
+ index: { name: 'succ_on_prerequisite' },
11
+ foreign_key: { to_table: :sis_core_curriculum_courses }
12
+ t.timestamps
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ class CreateSisCoreBuildings < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_buildings do |t|
4
+ t.string :code, null: false
5
+ t.string :name, null: false
6
+ t.string :location, null: false
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,21 @@
1
+ class CreateSisCoreClassrooms < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_classrooms do |t|
4
+ t.references :building,
5
+ null: false,
6
+ index: { name: 'bldg_on_cls_rm' },
7
+ foreign_key: { to_table: :sis_core_buildings }
8
+ t.references :programme_level,
9
+ null: false,
10
+ index: { name: 'pl_on_cls_rm' },
11
+ foreign_key: { to_table: :sis_core_lookups }
12
+ t.float :square_meter
13
+ t.string :room_number, null: false
14
+ t.string :floor, null: false
15
+ t.integer :class_size
16
+ t.string :class_type, null: false
17
+
18
+ t.timestamps
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ class CreateSisCoreClassTimeTables < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_class_time_tables do |t|
4
+ t.string :name, null: false
5
+ t.string :from, null: false
6
+ t.string :to, null: false
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ class CreateSisCoreSections < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_sections do |t|
4
+ t.string :name, null: false
5
+ t.references :entry,
6
+ null: false,
7
+ index: { name: 'entry_on_sec' },
8
+ foreign_key: { to_table: :sis_core_lookups }
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,22 @@
1
+ class CreateSisCoreCourseAssignments < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_course_assignments do |t|
4
+ t.references :course_offering,
5
+ null: false,
6
+ index: { name: 'crs_off_on_crs_ass' },
7
+ foreign_key: { to_table: :sis_core_course_offerings }
8
+ t.references :section,
9
+ null: false,
10
+ index: { name: 'sec_on_crs_ass' },
11
+ foreign_key: { to_table: :sis_core_sections }
12
+ t.references :instructor,
13
+ null: false,
14
+ index: { name: 'ins_on_crs_ass' },
15
+ foreign_key: { to_table: :sis_core_instructors }
16
+ t.integer :lab_instructor_id, null: true
17
+ t.integer :tutorial_instructor_id, null: true
18
+
19
+ t.timestamps
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ class CreateSisCoreClassSchedules < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_class_schedules do |t|
4
+ t.references :classroom,
5
+ null: true,
6
+ index: { name: 'cls_on_cls_sched' },
7
+ foreign_key: { to_table: :sis_core_classrooms }
8
+ t.references :class_time_table,
9
+ null: true,
10
+ index: { name: 'cls_time_tbl_on_cls_sched' },
11
+ foreign_key: { to_table: :sis_core_class_time_tables }
12
+ t.references :course_assignment,
13
+ null: false,
14
+ index: { name: 'crs_ass_on_cls_sched' },
15
+ foreign_key: { to_table: :sis_core_course_assignments }
16
+ t.string :day
17
+ t.string :schedule_type
18
+
19
+ t.timestamps
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ class CreateSisCoreAcademicCalendars < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_academic_calendars do |t|
4
+ t.references :academic_year,
5
+ null: false,
6
+ index: { name: 'ay_on_aca_caldr_indx' },
7
+ foreign_key: { to_table: :sis_core_academic_years }
8
+ t.references :semester,
9
+ null: false,
10
+ index: { name: 'sem_on_aca_caldr_indx' },
11
+ foreign_key: { to_table: :sis_core_semesters }
12
+ t.date :start_date, null: false
13
+ t.date :end_date, null: false
14
+ t.string :event, null: false
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,37 @@
1
+ class CreateSisCoreAcademicTimeLines < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_academic_time_lines do |t|
4
+ t.date :registration_start_date, null: false
5
+ t.date :registration_end_date, null: false
6
+ t.date :penalty_registration_start_date, null: false
7
+ t.date :penalty_registration_end_date, null: false
8
+ t.date :add_and_drop_start_date, null: false
9
+ t.date :add_and_drop_end_date, null: false
10
+ t.date :penalty_add_and_drop_start_date, null: false
11
+ t.date :penalty_add_and_drop_end_date, null: false
12
+ t.date :mid_exam_start_date, null: false
13
+ t.date :mid_exam_end_date, null: false
14
+ t.date :final_exam_start_date, null: false
15
+ t.date :final_exam_end_date, null: false
16
+ t.date :grade_reporting_date, null: false
17
+ t.references :academic_year,
18
+ null: false,
19
+ index: { name: 'ay_on_aca_time_line_indx' },
20
+ foreign_key: { to_table: :sis_core_academic_years }
21
+ t.references :semester,
22
+ null: false,
23
+ index: { name: 'sem_on_aca_time_line_indx' },
24
+ foreign_key: { to_table: :sis_core_semesters }
25
+ t.references :programme_type,
26
+ null: false,
27
+ index: { name: 'pt_on_aca_time_line_indx' },
28
+ foreign_key: { to_table: :sis_core_lookups }
29
+ t.references :programme_level,
30
+ null: false,
31
+ index: { name: 'pl_on_aca_time_line_indx' },
32
+ foreign_key: { to_table: :sis_core_lookups }
33
+
34
+ t.timestamps
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,13 @@
1
+ class CreateSisCoreEligibilityCriteria < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_eligibility_criteria do |t|
4
+ t.references :clearing_role,
5
+ null: false,
6
+ index: { name: 'clr_role_on_eli_criteria' },
7
+ foreign_key: { to_table: :sis_core_user_roles }
8
+ t.string :description
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end