sis_core 1.0.7 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d9b0264aef8769263ead6f9f8bcef7b789ca2a52ec27478a1646e0626e67ebb
4
- data.tar.gz: f5c6909c614cd0ff7fdc75d922d22836c030be6a951e60cc4f640895f7e62bb2
3
+ metadata.gz: 0a391a271ae5aa358a916776b0e2eedf3fc09cdb49e522627c81a5eefcdf6072
4
+ data.tar.gz: 667e0483f0eb8dbac9d6bb81d2e7b98d3f59bb3244e3251f23010a921db5a8c7
5
5
  SHA512:
6
- metadata.gz: 061ec28c7971d97981cd84d3662350d261c30fb5a5cfa845f7d9b7be7bcd06e341f4cb40976d48fa850b52adfcfb9cc29f1b78cf707b7fdfed52aa7a071bc16b
7
- data.tar.gz: 9293603b43d28e10bbe8d79024fc1c5392bdd5c43e2b378fc1497acc36624c95d108d8fc138acb5839abb47e336c2adbed2fca576727a33caeecd8163fecbc42
6
+ metadata.gz: 8ac73e86b89644a285ddb1b45425daa0e809f80b0023f3dcbf091eec7344819ee51b22a2ff791268dad3ec701bf9307f4256dd6e483700f6f11ec10d1f99df59
7
+ data.tar.gz: 4b9073797a0fc8317ba4f190678fba109444d8b1a0148383cbc7d5b694f61a56ffb39ba238bb1494bb5c2d10fc705cd3bb8dfbc0361616d6657a417095e16fde
@@ -11,8 +11,8 @@ module Sis
11
11
  user_menus.each do |user_menu|
12
12
  children = user_menu.children.where(parent_id: user_menu.id, application_module_id: app_module_id)
13
13
  children = children.map { |c| { label: c.text, icon: c.icon_cls, routerLink: [c.location] } }
14
- menus.push({ label: user_menu.text, icon: user_menu.icon_cls, location: user_menu.location,
15
- items: children })
14
+ menus.push({ id: user_menu.id, label: user_menu.text, icon: user_menu.icon_cls,
15
+ location: user_menu.location, items: children, expanded: true })
16
16
  end
17
17
  end
18
18
  render json: { success: true, data: menus }
@@ -27,7 +27,8 @@ module Sis
27
27
  def login
28
28
  user = User.find_by_email(params[:email])
29
29
  if User&.find_by_email(params[:email]) && user.authenticate(params[:password])
30
- token = JsonWebToken.encode({ id: user.id, first_name: user.first_name, last_name: user.last_name })
30
+ token = JsonWebToken.encode({ id: user.id, first_name: user.first_name, last_name: user.last_name,
31
+ roles: user.user_roles.map(&:name) })
31
32
  render json: { success: true, jwt: token }
32
33
  else
33
34
  render json: { success: false, errors: ['Invalid username or password !'] }
@@ -5,11 +5,21 @@ module Sis
5
5
  validates :first_name, :middle_name, :last_name, :email, presence: true
6
6
  validates :email, uniqueness: true
7
7
 
8
+ has_many :applications
9
+
8
10
  has_secure_password
9
11
 
10
12
  def full_name
11
13
  first_name + ' ' + middle_name + ' ' + last_name
12
14
  end
15
+
16
+ scope :by_application_setup, (lambda do |app_setup_id|
17
+ joins(applications: :application_setup).where('sis_core_applications.application_setup_id': app_setup_id)
18
+ end)
19
+
20
+ scope :by_status, (lambda do |status|
21
+ joins(:applications).where('sis_core_applications.status': status)
22
+ end)
13
23
  end
14
24
  end
15
25
  end
@@ -9,18 +9,15 @@ module Sis
9
9
 
10
10
  aasm column: :status do
11
11
  state :draft, initial: true
12
- state :submitted, :under_review, :accepted, :rejected, :selected_for_exam, :selected_for_admission
12
+ state :submitted, :under_review, :rejected, :selected_for_exam, :selected_for_admission, :waiting, :accepted,
13
+ :declined
13
14
 
14
15
  event :submit do
15
16
  transitions from: :draft, to: :submitted
16
17
  end
17
18
 
18
19
  event :review do
19
- transitions from: %i[submitted rejected accepted], to: :under_review
20
- end
21
-
22
- event :accept do
23
- transitions from: :under_review, to: :accepted
20
+ transitions from: %i[submitted rejected], to: :under_review
24
21
  end
25
22
 
26
23
  event :reject do
@@ -28,12 +25,24 @@ module Sis
28
25
  end
29
26
 
30
27
  event :select_for_exam do
31
- transitions from: :accepted, to: :selected_for_exam
28
+ transitions from: %i[submitted under_review], to: :selected_for_exam
32
29
  end
33
30
 
34
31
  event :select_for_admission do
35
32
  transitions from: :selected_for_exam, to: :selected_for_admission
36
33
  end
34
+
35
+ event :select_for_waiting do
36
+ transitions from: :selected_for_exam, to: :waiting
37
+ end
38
+
39
+ event :accept do
40
+ transitions from: :selected_for_admission, to: :accepted
41
+ end
42
+
43
+ event :decline do
44
+ transitions from: :selected_for_admission, to: :declined
45
+ end
37
46
  end
38
47
 
39
48
  validates :status, presence: true
@@ -42,6 +51,7 @@ module Sis
42
51
  belongs_to :applicant
43
52
  belongs_to :academic_programme
44
53
  belongs_to :application_setup
54
+ has_many :application_documents
45
55
 
46
56
  delegate(:name, to: :academic_programme, prefix: true, allow_nil: false)
47
57
  delegate(:full_name, to: :applicant, prefix: true, allow_nil: false)
@@ -7,6 +7,7 @@ module Sis
7
7
  belongs_to :academic_programme
8
8
  belongs_to :target_semester, class_name: 'Sis::Core::Semester'
9
9
  has_many :document_requirements
10
+ has_many :exam_setups
10
11
 
11
12
  validates :start_date, :end_date, :status, presence: true
12
13
  validates :status, inclusion: [OPEN, CLOSED]
@@ -0,0 +1,13 @@
1
+ module Sis
2
+ module Core
3
+ class CreditHourRate < ApplicationRecord
4
+ belongs_to :programme_level
5
+ belongs_to :currency
6
+
7
+ validates :rate, presence: true
8
+
9
+ delegate(:name, to: :programme_level, prefix: true, allow_nil: false)
10
+ delegate(:name, to: :currency, prefix: true, allow_nil: false)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ module Sis
2
+ module Core
3
+ class Currency < Lookup
4
+ validates :name, presence: true
5
+ end
6
+ end
7
+ end
@@ -12,6 +12,10 @@ module Sis
12
12
  end
13
13
 
14
14
  delegate(:name, to: :exam_setup, prefix: true, allow_nil: false)
15
+
16
+ scope :by_application_setup, (lambda do |app_setup_id|
17
+ joins(:exam_setup).where('sis_core_exam_setups.application_setup_id': app_setup_id)
18
+ end)
15
19
  end
16
20
  end
17
21
  end
@@ -2,6 +2,7 @@ module Sis
2
2
  module Core
3
3
  class ExamSetup < ApplicationRecord
4
4
  belongs_to :application_setup
5
+ has_many :exams
5
6
 
6
7
  validates :date, :hours, :venue, presence: true
7
8
 
@@ -12,7 +12,7 @@ module Sis
12
12
  # Override the directory where uploaded files will be stored.
13
13
  # This is a sensible default for uploaders that are meant to be mounted:
14
14
  def store_dir
15
- "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
15
+ ENV.fetch('UPLOAD_PREFIX') + "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
16
16
  end
17
17
 
18
18
  # Provide a default URL as a default if there hasn't been a file uploaded:
@@ -12,7 +12,7 @@ module Sis
12
12
  # Override the directory where uploaded files will be stored.
13
13
  # This is a sensible default for uploaders that are meant to be mounted:
14
14
  def store_dir
15
- "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
15
+ ENV.fetch('UPLOAD_PREFIX') + "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
16
16
  end
17
17
 
18
18
  # Provide a default URL as a default if there hasn't been a file uploaded:
@@ -0,0 +1,17 @@
1
+ class CreateSisCoreCreditHourRates < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :sis_core_credit_hour_rates do |t|
4
+ t.references :programme_level,
5
+ null: false,
6
+ index: { name: 'pr_level_on_chr_hr_rate_indx' },
7
+ foreign_key: { to_table: :sis_core_lookups }
8
+ t.references :currency,
9
+ null: false,
10
+ index: { name: 'currency_on_chr_hr_rate_indx' },
11
+ foreign_key: { to_table: :sis_core_lookups }
12
+ t.float :rate, null: false
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -4,7 +4,6 @@ module Sis
4
4
  isolate_namespace Sis::Core
5
5
 
6
6
  config.generators.api_only = true
7
- config.eager_load_paths << Sis::Core::Engine.root.join('lib')
8
7
  config.autoload_paths << Sis::Core::Engine.root.join('lib')
9
8
 
10
9
  config.generators do |g|
@@ -1,5 +1,5 @@
1
1
  module Sis
2
2
  module Core
3
- VERSION = '1.0.7'.freeze
3
+ VERSION = '1.0.12'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :credit_hour_rate, class: Sis::Core::CreditHourRate do
3
+ association :programme_level
4
+ association :currency
5
+ rate { 1.5 }
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ FactoryBot.define do
2
+ factory :currency, class: Sis::Core::Currency, parent: :lookup do
3
+ type { 'Sis::Core::Currency' }
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
2
  factory :programme_level, class: Sis::Core::ProgrammeLevel, parent: :lookup do
3
- type { 'Ecom::Core::ProgrammeLevel' }
3
+ type { 'Sis::Core::ProgrammeLevel' }
4
4
  end
5
5
  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.7
4
+ version: 1.0.12
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-06-27 00:00:00.000000000 Z
11
+ date: 2020-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aasm
@@ -100,20 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 6.0.2
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- version: 6.0.2.1
103
+ version: 6.0.3
107
104
  type: :runtime
108
105
  prerelease: false
109
106
  version_requirements: !ruby/object:Gem::Requirement
110
107
  requirements:
111
108
  - - "~>"
112
109
  - !ruby/object:Gem::Version
113
- version: 6.0.2
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- version: 6.0.2.1
110
+ version: 6.0.3
117
111
  - !ruby/object:Gem::Dependency
118
112
  name: sqlite3
119
113
  requirement: !ruby/object:Gem::Requirement
@@ -242,6 +236,8 @@ files:
242
236
  - app/models/sis/core/application_setup.rb
243
237
  - app/models/sis/core/course.rb
244
238
  - app/models/sis/core/course_registration.rb
239
+ - app/models/sis/core/credit_hour_rate.rb
240
+ - app/models/sis/core/currency.rb
245
241
  - app/models/sis/core/document_requirement.rb
246
242
  - app/models/sis/core/document_type.rb
247
243
  - app/models/sis/core/exam.rb
@@ -286,6 +282,7 @@ files:
286
282
  - db/migrate/20200511165121_create_sis_core_application_modules.rb
287
283
  - db/migrate/20200511165241_create_sis_core_user_roles.rb
288
284
  - db/migrate/20200511165450_create_sis_core_menus.rb
285
+ - db/migrate/20200919235516_create_sis_core_credit_hour_rates.rb
289
286
  - lib/authorize_request.rb
290
287
  - lib/json_web_token.rb
291
288
  - lib/sis/core.rb
@@ -302,6 +299,8 @@ files:
302
299
  - spec/factories/sis/core/applications.rb
303
300
  - spec/factories/sis/core/course_registrations.rb
304
301
  - spec/factories/sis/core/courses.rb
302
+ - spec/factories/sis/core/credit_hour_rates.rb
303
+ - spec/factories/sis/core/currencies.rb
305
304
  - spec/factories/sis/core/document_requirements.rb
306
305
  - spec/factories/sis/core/document_types.rb
307
306
  - spec/factories/sis/core/exam_results.rb
@@ -337,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
337
336
  - !ruby/object:Gem::Version
338
337
  version: '0'
339
338
  requirements: []
340
- rubygems_version: 3.1.2
339
+ rubygems_version: 3.1.4
341
340
  signing_key:
342
341
  specification_version: 4
343
342
  summary: Core engine for student information system application.