sis_core 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/sis/core/academic_year.rb +6 -0
  3. data/app/models/sis/core/course.rb +10 -0
  4. data/app/models/sis/core/course_registration.rb +9 -0
  5. data/app/models/sis/core/instructor.rb +6 -0
  6. data/app/models/sis/core/instructor_course.rb +8 -0
  7. data/app/models/sis/core/semester.rb +7 -0
  8. data/app/models/sis/core/staff.rb +21 -0
  9. data/app/models/sis/core/student.rb +7 -0
  10. data/app/models/user.rb +3 -0
  11. data/db/migrate/20200307033100_create_sis_core_courses.rb +19 -0
  12. data/db/migrate/20200307071511_create_sis_core_instructors.rb +10 -0
  13. data/db/migrate/20200307071736_create_sis_core_instructor_courses.rb +16 -0
  14. data/db/migrate/20200307072006_create_sis_core_students.rb +16 -0
  15. data/db/migrate/20200307072142_create_sis_core_academic_years.rb +9 -0
  16. data/db/migrate/20200307072246_create_sis_core_semesters.rb +14 -0
  17. data/db/migrate/20200307072317_create_sis_core_course_registrations.rb +20 -0
  18. data/db/migrate/20200316120805_create_sis_core_staffs.rb +31 -0
  19. data/db/migrate/20200319074334_modify_user.rb +16 -0
  20. data/lib/sis/core/version.rb +1 -1
  21. data/spec/factories/sis/core/academic_years.rb +5 -0
  22. data/spec/factories/sis/core/course_registrations.rb +7 -0
  23. data/spec/factories/sis/core/courses.rb +12 -0
  24. data/spec/factories/sis/core/instructor_courses.rb +6 -0
  25. data/spec/factories/sis/core/instructors.rb +6 -0
  26. data/spec/factories/sis/core/semesters.rb +7 -0
  27. data/spec/factories/sis/core/staffs.rb +32 -0
  28. data/spec/factories/sis/core/students.rb +9 -0
  29. data/spec/factories/users.rb +11 -0
  30. metadata +28 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c5c35209b30494fac39af83105c8317aee1f412c3271b224479f5897ed67ad1
4
- data.tar.gz: 3c09e2a7dd305dbb39179ca09f219d3a25c96731cffd0fa85f0b9e65cd565e83
3
+ metadata.gz: 3d6d06580eeab8666073ed41a67aec635989681c89ac979d8303ec85e0adf15f
4
+ data.tar.gz: 2f34eb2200e4a15dc40775f8c1fac1006ec1b588be232f6d10b50483dec87d01
5
5
  SHA512:
6
- metadata.gz: f26a6169dd2460db579620a70ffbc87c5c40a1dbe79cc184ecbb4909af063f422b033799e9cacc39619605c57d0d39eef4007acffb39c1ab11c5cf64edd5c47f
7
- data.tar.gz: 45f8515c2b6f5113fc76e70fa20f97bde6d3161e14f8116cbc7170d1f9667468dce31548c54959180d6cabec38bf7695aac9d77d2031e33d17ebb3744f625155
6
+ metadata.gz: a4916c93eaf0adab13edd713779386a00ceacca0618e19a5fe56841cebda7d8dedafdd270956471d740ea884c5841f24dbe812f336fd6f30b6656ed4045baaed
7
+ data.tar.gz: 3d7d5c4deb881a3f94d708176af6d3847bea0c675f02cd93590ddbde8ebb6354416c31ff05625fc89044c096edb8a6fbeeab74f04144410f9aad4b234aaada7e
@@ -0,0 +1,6 @@
1
+ module Sis
2
+ module Core
3
+ class AcademicYear < ApplicationRecord
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ module Sis
2
+ module Core
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
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module Sis
2
+ module Core
3
+ class CourseRegistration < ApplicationRecord
4
+ belongs_to :course
5
+ belongs_to :student
6
+ belongs_to :semester
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ module Sis
2
+ module Core
3
+ class Instructor < ApplicationRecord
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ module Sis
2
+ module Core
3
+ class InstructorCourse < ApplicationRecord
4
+ belongs_to :instructor
5
+ belongs_to :course
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module Sis
2
+ module Core
3
+ class Semester < ApplicationRecord
4
+ belongs_to :academic_year
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,21 @@
1
+ module Sis
2
+ module Core
3
+ class Staff < ApplicationRecord
4
+ belongs_to :user, class_name: 'User'
5
+ SINGLE = 'Single'.freeze
6
+ MARRIED = 'Married'.freeze
7
+ MARITAL_STATUS = [SINGLE, MARRIED].freeze
8
+ validates :job_title, :job_level, :department, :date_of_employment, :salary,
9
+ :remark, :mothers_name, :education_level, :phone_number,
10
+ :place_of_birth, :marital_status, :region, :zone, :wereda,
11
+ :kebele, :id_number,
12
+ :emergency_contact_name, :emergency_contact_phone,
13
+ :relation_to_emergency_contact, :user_id,
14
+ presence: true
15
+ validates :salary, numericality: true
16
+ validates :marital_status, inclusion: { in: MARITAL_STATUS }
17
+ validates :id_number, uniqueness: true
18
+ validates :passport_number, uniqueness: true, if: :passport_number?
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ module Sis
2
+ module Core
3
+ class Student < ApplicationRecord
4
+ belongs_to :program
5
+ end
6
+ end
7
+ end
@@ -1,9 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class User < ActiveRecord::Base
4
+ extend Devise::Models
4
5
  # Include default devise modules. Others available are:
5
6
  # :confirmable, :lockable, :timeoutable and :omniauthable
6
7
  devise :database_authenticatable, :registerable,
7
8
  :recoverable, :rememberable, :trackable, :validatable
8
9
  include DeviseTokenAuth::Concerns::User
10
+
11
+ validates :first_name, :middle_name, :last_name, :password, :email, :gender, :date_of_birth, presence: true
9
12
  end
@@ -0,0 +1,19 @@
1
+ class CreateSisCoreCourses < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_courses do |t|
4
+ t.string :code, null: false, unique: true
5
+ t.string :title, null: false
6
+ t.string :description, null: false
7
+ t.float :credit_hours, null: false
8
+ t.float :ects, null: false
9
+ t.float :lecture_hours, null: false
10
+ t.float :lab_hours, null: false
11
+ t.references :program,
12
+ index: { name: 'program_on_courses_indx' },
13
+ null: false,
14
+ foreign_key: { to_table: :sis_core_programs }
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,10 @@
1
+ class CreateSisCoreInstructors < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_instructors do |t|
4
+ t.string :full_name, null: false
5
+ t.date :date_of_birth, null: false
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,16 @@
1
+ class CreateSisCoreInstructorCourses < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_instructor_courses do |t|
4
+ t.references :instructor,
5
+ index: { name: 'instructor_on_ic_indx' },
6
+ null: false,
7
+ foreign_key: { to_table: :sis_core_instructors }
8
+ t.references :course,
9
+ index: { name: 'course_on_ic_indx' },
10
+ null: false,
11
+ foreign_key: { to_table: :sis_core_courses }
12
+
13
+ t.timestamps
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ class CreateSisCoreStudents < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_students do |t|
4
+ t.string :student_id, null: false, unique: true
5
+ t.string :full_name, null: false
6
+ t.date :date_of_birth, null: false
7
+ t.string :nationality, null: false
8
+ t.references :program,
9
+ index: { name: 'program_on_student_indx' },
10
+ null: false,
11
+ foreign_key: { to_table: :sis_core_programs }
12
+
13
+ t.timestamps
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ class CreateSisCoreAcademicYears < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_academic_years do |t|
4
+ t.string :year, null: false
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ class CreateSisCoreSemesters < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_semesters do |t|
4
+ t.string :name, null: false
5
+ t.string :description
6
+ t.references :academic_year,
7
+ index: { name: 'ay_on_semester_indx' },
8
+ null: false,
9
+ foreign_key: { to_table: :sis_core_academic_years }
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,20 @@
1
+ class CreateSisCoreCourseRegistrations < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_course_registrations do |t|
4
+ t.references :course,
5
+ index: { name: 'course_on_cr_indx' },
6
+ null: false,
7
+ foreign_key: { to_table: :sis_core_courses }
8
+ t.references :student,
9
+ index: { name: 'student_on_cr_indx' },
10
+ null: false,
11
+ foreign_key: { to_table: :sis_core_students }
12
+ t.references :semester,
13
+ index: { name: 'semester_on_cr_indx' },
14
+ null: false,
15
+ foreign_key: { to_table: :sis_core_semesters }
16
+
17
+ t.timestamps
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,31 @@
1
+ class CreateSisCoreStaffs < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_staffs do |t|
4
+ t.string :job_title, null: false
5
+ t.string :job_level, null: false
6
+ t.string :department, null: false
7
+ t.date :date_of_employment, null: false
8
+ t.float :salary, null: false
9
+ t.text :remark, null: false
10
+ t.string :mothers_name, null: false
11
+ t.string :education_level, null: false
12
+ t.string :phone_number, null: false
13
+ t.string :place_of_birth, null: false
14
+ t.string :marital_status, null: false
15
+ t.string :region, null: false
16
+ t.string :zone, null: false
17
+ t.string :wereda, null: false
18
+ t.string :kebele, null: false
19
+ t.string :passport_number
20
+ t.string :id_number, null: false, unique: true
21
+ t.string :emergency_contact_name, null: false
22
+ t.string :emergency_contact_phone, null: false
23
+ t.string :relation_to_emergency_contact, null: false
24
+ t.references :user,
25
+ index: { name: 'user_on_staff_indx' },
26
+ null: false,
27
+ foreign_key: { to_table: :users }
28
+ t.timestamps
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,16 @@
1
+ class ModifyUser < ActiveRecord::Migration[6.0]
2
+ def change
3
+ remove_column :users, :name, :string
4
+ remove_column :users, :nickname, :string
5
+ add_column :users, :first_name, :string
6
+ add_column :users, :middle_name, :string
7
+ add_column :users, :last_name, :string
8
+ add_column :users, :gender, :string
9
+ add_column :users, :date_of_birth, :date
10
+ change_column :users, :first_name, :string, null: false
11
+ change_column :users, :middle_name, :string, null: false
12
+ change_column :users, :last_name, :string, null: false
13
+ change_column :users, :gender, :string, null: false
14
+ change_column :users, :date_of_birth, :date, null: false
15
+ end
16
+ end
@@ -1,5 +1,5 @@
1
1
  module Sis
2
2
  module Core
3
- VERSION = '1.0.2'.freeze
3
+ VERSION = '1.0.3'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,5 @@
1
+ FactoryBot.define do
2
+ factory :sis_core_academic_year, class: 'AcademicYear' do
3
+ year { '2000/01' }
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :course_registration, class: 'Sis::Core::CourseRegistration' do
3
+ association :course
4
+ association :student
5
+ association :semester
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ FactoryBot.define do
2
+ factory :course, class: 'Sis::Core::Course' do
3
+ code { FFaker::Name.name }
4
+ title { FFaker::Name.name }
5
+ description { FFaker::Lorem.paragraph }
6
+ credit_hours { FFaker::Random.rand(1..4) }
7
+ ects { FFaker::Random.rand(1..10) }
8
+ lecture_hours { FFaker::Random.rand(1..4) }
9
+ lab_hours { FFaker::Random.rand(1..4) }
10
+ association :program
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :instructor_course, class: 'Sis::Core::InstructorCourse' do
3
+ association :instructor
4
+ association :course
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :instructor, class: 'Sis::Core::Instructor' do
3
+ full_name { FFaker::Name.name }
4
+ date_of_birth { Date.new(2000, 1, 1) }
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :semester, class: 'Sis::Core::Semester' do
3
+ association :academic_year
4
+ name { FFaker::Name.name }
5
+ description { FFaker::Name.name }
6
+ end
7
+ end
@@ -0,0 +1,32 @@
1
+ FactoryBot.define do
2
+ SINGLE = 'Single'.freeze
3
+ MARRIED = 'Married'.freeze
4
+ MARITAL_STATUS = [SINGLE, MARRIED].freeze
5
+ factory :staff, class: 'Sis::Core::Staff' do
6
+ user
7
+ job_title { FFaker::Job.title }
8
+ job_level { FFaker::Company.position }
9
+ department { FFaker::Education.school_name }
10
+ date_of_employment { FFaker::Time.date }
11
+ salary { [2000, 5500.5, 10_000, 20_000].sample }
12
+ remark { FFaker::Lorem.sentence }
13
+ mothers_name { FFaker::Name.name }
14
+ education_level { FFaker::Education.degree }
15
+ phone_number { FFaker::PhoneNumber.phone_number }
16
+ place_of_birth { FFaker::Address.city }
17
+ marital_status { %w[Single Married].sample }
18
+ region { FFaker::Address.city }
19
+ zone { FFaker::Address.neighborhood }
20
+ wereda { [1, 2, 5, 13].sample }
21
+ kebele { [1, 2, 5, 13].sample }
22
+ passport_number { FFaker::Guid.guid }
23
+ id_number { FFaker::Guid.guid }
24
+ emergency_contact_name { FFaker::Name.name }
25
+ emergency_contact_phone { FFaker::PhoneNumber.phone_number }
26
+ relation_to_emergency_contact do
27
+ %w[mother,father,brother,spouse].sample
28
+ end
29
+ created_at { FFaker::Time.datetime }
30
+ updated_at { FFaker::Time.datetime }
31
+ end
32
+ end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :student, class: 'Sis::Core::Student' do
3
+ student_id { FFaker::Name.name }
4
+ full_name { FFaker::Name.name }
5
+ date_of_birth { Date.new(2000, 1, 1) }
6
+ nationality { FFaker::Name.name }
7
+ association :program
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ FactoryBot.define do
2
+ factory :user, class: 'User' do
3
+ first_name { FFaker::Name.first_name }
4
+ middle_name { FFaker::Name.name }
5
+ last_name { FFaker::Name.last_name }
6
+ password { FFaker::Internet.password }
7
+ email { FFaker::Internet.email }
8
+ gender { %w[male,female].sample }
9
+ date_of_birth { FFaker::Time.date }
10
+ end
11
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sis_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-01 00:00:00.000000000 Z
11
+ date: 2020-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devise_token_auth
@@ -140,14 +140,22 @@ files:
140
140
  - README.md
141
141
  - Rakefile
142
142
  - app/controllers/sis/core/application_controller.rb
143
+ - app/models/sis/core/academic_year.rb
143
144
  - app/models/sis/core/applicant.rb
144
145
  - app/models/sis/core/application_record.rb
145
146
  - app/models/sis/core/attached_document.rb
147
+ - app/models/sis/core/course.rb
148
+ - app/models/sis/core/course_registration.rb
146
149
  - app/models/sis/core/enrollment_application.rb
147
150
  - app/models/sis/core/field_of_study.rb
151
+ - app/models/sis/core/instructor.rb
152
+ - app/models/sis/core/instructor_course.rb
148
153
  - app/models/sis/core/lookup.rb
149
154
  - app/models/sis/core/program.rb
150
155
  - app/models/sis/core/program_type.rb
156
+ - app/models/sis/core/semester.rb
157
+ - app/models/sis/core/staff.rb
158
+ - app/models/sis/core/student.rb
151
159
  - app/models/user.rb
152
160
  - config/database.ci.yml
153
161
  - config/initializers/devise_token_auth.rb
@@ -159,18 +167,36 @@ files:
159
167
  - db/migrate/20200108092202_devise_token_auth_create_users.rb
160
168
  - db/migrate/20200108094449_create_sis_core_enrollment_applications.rb
161
169
  - db/migrate/20200108101638_create_sis_core_attached_documents.rb
170
+ - db/migrate/20200307033100_create_sis_core_courses.rb
171
+ - db/migrate/20200307071511_create_sis_core_instructors.rb
172
+ - db/migrate/20200307071736_create_sis_core_instructor_courses.rb
173
+ - db/migrate/20200307072006_create_sis_core_students.rb
174
+ - db/migrate/20200307072142_create_sis_core_academic_years.rb
175
+ - db/migrate/20200307072246_create_sis_core_semesters.rb
176
+ - db/migrate/20200307072317_create_sis_core_course_registrations.rb
177
+ - db/migrate/20200316120805_create_sis_core_staffs.rb
178
+ - db/migrate/20200319074334_modify_user.rb
162
179
  - lib/sis/core.rb
163
180
  - lib/sis/core/engine.rb
164
181
  - lib/sis/core/version.rb
165
182
  - lib/sis_core.rb
166
183
  - lib/tasks/sis_core_tasks.rake
184
+ - spec/factories/sis/core/academic_years.rb
167
185
  - spec/factories/sis/core/applicants.rb
168
186
  - spec/factories/sis/core/attached_documents.rb
187
+ - spec/factories/sis/core/course_registrations.rb
188
+ - spec/factories/sis/core/courses.rb
169
189
  - spec/factories/sis/core/enrollment_applications.rb
170
190
  - spec/factories/sis/core/field_of_studies.rb
191
+ - spec/factories/sis/core/instructor_courses.rb
192
+ - spec/factories/sis/core/instructors.rb
171
193
  - spec/factories/sis/core/lookups.rb
172
194
  - spec/factories/sis/core/program_types.rb
173
195
  - spec/factories/sis/core/programs.rb
196
+ - spec/factories/sis/core/semesters.rb
197
+ - spec/factories/sis/core/staffs.rb
198
+ - spec/factories/sis/core/students.rb
199
+ - spec/factories/users.rb
174
200
  homepage: http://www.mks.com.et
175
201
  licenses:
176
202
  - MIT