diff --git a/Gemfile b/Gemfile index 82392a583..c5c1af641 100644 --- a/Gemfile +++ b/Gemfile @@ -65,6 +65,7 @@ group :test do gem 'chromedriver-helper' gem 'codacy-coverage', require: false gem 'selenium-webdriver' + gem 'webmock' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index eb98a4278..ecd69693c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,15 +44,15 @@ GEM tzinfo (~> 1.1) addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) - ancestry (3.0.3) + ancestry (3.0.4) activerecord (>= 3.2.0) archive-zip (0.11.0) io-like (~> 0.3.0) arel (9.0.0) ast (2.4.0) aws-eventstream (1.0.1) - aws-partitions (1.106.0) - aws-sdk-core (3.35.0) + aws-partitions (1.107.0) + aws-sdk-core (3.36.0) aws-eventstream (~> 1.0) aws-partitions (~> 1.0) aws-sigv4 (~> 1.0) @@ -60,7 +60,7 @@ GEM aws-sdk-kms (1.11.0) aws-sdk-core (~> 3, >= 3.26.0) aws-sigv4 (~> 1.0) - aws-sdk-s3 (1.23.0) + aws-sdk-s3 (1.23.1) aws-sdk-core (~> 3, >= 3.26.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.0) @@ -71,14 +71,14 @@ GEM msgpack (~> 1.0) brakeman (4.3.1) builder (3.2.3) - bullet (5.7.6) + bullet (5.8.1) activesupport (>= 3.0.0) - uniform_notifier (~> 1.11.0) + uniform_notifier (~> 1.11) bundler-audit (0.6.0) bundler (~> 1.2) thor (~> 0.18) byebug (10.0.2) - capybara (3.10.0) + capybara (3.10.1) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -96,8 +96,10 @@ GEM codacy-coverage (2.1.0) simplecov coderay (1.1.2) - concurrent-ruby (1.0.5) + concurrent-ruby (1.1.1) connection_pool (2.2.2) + crack (0.4.3) + safe_yaml (~> 1.0.0) crass (1.0.4) devise (4.5.0) bcrypt (~> 3.0) @@ -124,8 +126,9 @@ GEM activerecord (>= 4.0.0) globalid (0.4.1) activesupport (>= 4.2.0) - groupdate (4.0.2) + groupdate (4.1.0) activesupport (>= 4.2) + hashdiff (0.3.7) i18n (1.1.1) concurrent-ruby (~> 1.0) image_processing (1.7.1) @@ -133,7 +136,7 @@ GEM ruby-vips (>= 2.0.13, < 3) io-like (0.3.0) jaro_winkler (1.5.1) - jbuilder (2.7.0) + jbuilder (2.8.0) activesupport (>= 4.2.0) multi_json (>= 1.2) jmespath (1.4.0) @@ -153,7 +156,7 @@ GEM mini_mime (>= 0.1.1) marcel (0.3.3) mimemagic (~> 0.3.2) - method_source (0.9.0) + method_source (0.9.1) mimemagic (0.3.2) mini_magick (4.9.2) mini_mime (1.0.1) @@ -168,7 +171,7 @@ GEM orm_adapter (0.5.0) pagy (0.21.0) parallel (1.12.1) - parser (2.5.1.2) + parser (2.5.3.0) ast (~> 2.4.0) pg (1.1.3) pg_search (2.1.2) @@ -176,14 +179,14 @@ GEM activesupport (>= 4.2) arel (>= 6) powerpack (0.1.2) - pry (0.11.3) + pry (0.12.0) coderay (~> 1.1.0) method_source (~> 0.9.0) pry-rails (0.3.6) pry (>= 0.10.4) public_suffix (3.0.3) puma (3.12.0) - rack (2.0.5) + rack (2.0.6) rack-protection (2.0.4) rack rack-test (1.1.0) @@ -217,7 +220,7 @@ GEM rb-fsevent (0.10.3) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) - redis (4.0.2) + redis (4.0.3) regexp_parser (1.2.0) responders (2.4.0) actionpack (>= 4.2.0, < 5.3) @@ -237,22 +240,17 @@ GEM ffi (~> 1.9) ruby_dep (1.5.0) rubyzip (1.2.2) - sass (3.6.0) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sassc (1.12.1) + safe_yaml (1.0.4) + sassc (2.0.0) ffi (~> 1.9.6) - sass (>= 3.3.0) - sassc-rails (1.3.0) + rake + sassc-rails (2.0.0) railties (>= 4.0.0) - sass - sassc (~> 1.9) - sprockets (> 2.11) + sassc (>= 2.0) + sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (3.14.1) + selenium-webdriver (3.141.0) childprocess (~> 0.5) rubyzip (~> 1.2, >= 1.2.2) sidekiq (5.2.2) @@ -281,7 +279,7 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - swearjar (1.2.1) + swearjar (1.3.0) thor (0.20.0) thread_safe (0.3.6) tilt (2.0.8) @@ -293,7 +291,7 @@ GEM unf_ext unf_ext (0.0.7.5) unicode-display_width (1.4.0) - uniform_notifier (1.11.0) + uniform_notifier (1.12.1) warden (1.2.7) rack (>= 1.0) web-console (3.7.0) @@ -301,6 +299,10 @@ GEM activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) + webmock (3.4.2) + addressable (>= 2.3.6) + crack (>= 0.3.2) + hashdiff websocket-driver (0.7.0) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.3) @@ -354,9 +356,10 @@ DEPENDENCIES spring-watcher-listen (~> 2.0.0) uglifier (>= 1.3.0) web-console (>= 3.3.0) + webmock RUBY VERSION ruby 2.5.1p57 BUNDLED WITH - 1.16.6 + 1.17.1 diff --git a/app/models/prospective_student.rb b/app/models/prospective_student.rb index b3450ecdc..35cd3b2c2 100644 --- a/app/models/prospective_student.rb +++ b/app/models/prospective_student.rb @@ -38,7 +38,7 @@ class ProspectiveStudent < ApplicationRecord # enumerations enum gender: { male: 1, female: 2 } enum nationality: { turkish: 1, kktc: 2, foreign: 3 } - enum placement_type: { general: 1, additional_score: 2 } + enum placement_type: { general_score: 1, additional_score: 2 } enum additional_score: { handicapped: 1 } # custom methods diff --git a/app/models/unit.rb b/app/models/unit.rb index ee19a8ff6..fd2f4b5f3 100644 --- a/app/models/unit.rb +++ b/app/models/unit.rb @@ -37,8 +37,8 @@ class Unit < ApplicationRecord has_many :prospective_students, dependent: :destroy # validations - validates :yoksis_id, uniqueness: true, allow_blank: true, numericality: { only_integer: true } - validates :detsis_id, uniqueness: true, allow_blank: true, numericality: { only_integer: true } + validates :yoksis_id, uniqueness: true, allow_blank: true, numericality: { only_integer: true }, length: { is: 6 } + validates :detsis_id, uniqueness: true, allow_blank: true, numericality: { only_integer: true }, length: { is: 8 } validates :name, presence: true, uniqueness: { scope: %i[ancestry unit_status] } validates :duration, numericality: { only_integer: true }, allow_blank: true, inclusion: 1..8 @@ -46,16 +46,17 @@ class Unit < ApplicationRecord before_save { self.name = name.capitalize_all } # scopes - scope :active, -> { where(unit_status: UnitStatus.active) } - scope :committees, -> { where(unit_type: UnitType.committee) } - scope :departments, -> { where(unit_type: UnitType.department) } - scope :faculties, -> { where(unit_type: UnitType.faculty) } - scope :programs, -> { where(unit_type: UnitType.program) } - scope :universities, -> { where(unit_type: UnitType.university) } - scope :majors, -> { where(unit_type: UnitType.major) } - scope :institutes, -> { where(unit_type: UnitType.institute) } - scope :rectorships, -> { where(unit_type: UnitType.rectorship) } - scope :without_programs, -> { where.not(unit_type: UnitType.program) } + scope :active, -> { where(unit_status: UnitStatus.active) } + scope :partially_passive, -> { where(unit_status: UnitStatus.partially_passive) } + scope :committees, -> { where(unit_type: UnitType.committee) } + scope :departments, -> { where(unit_type: UnitType.department) } + scope :faculties, -> { where(unit_type: UnitType.faculty) } + scope :programs, -> { where(unit_type: UnitType.program) } + scope :universities, -> { where(unit_type: UnitType.university) } + scope :majors, -> { where(unit_type: UnitType.major) } + scope :institutes, -> { where(unit_type: UnitType.institute) } + scope :rectorships, -> { where(unit_type: UnitType.rectorship) } + scope :without_programs, -> { where.not(unit_type: UnitType.program) } scope :coursable, -> { departments diff --git a/app/models/unit_status.rb b/app/models/unit_status.rb index 599b84fdc..5cf382274 100644 --- a/app/models/unit_status.rb +++ b/app/models/unit_status.rb @@ -8,5 +8,10 @@ class UnitStatus < ApplicationRecord has_many :units, dependent: :nullify # scopes - scope :active, -> { where(code: 1) } + scope :passive, -> { where(code: 0) } + scope :active, -> { where(code: 1) } + scope :partially_passive, -> { where(code: 2) } + scope :closed, -> { where(code: 3) } + scope :archived, -> { where(code: 4) } + scope :no_guide_code, -> { where(code: 5) } end diff --git a/app/services/xokul/connection.rb b/app/services/xokul/connection.rb index 7929f1c80..612cfa1d3 100644 --- a/app/services/xokul/connection.rb +++ b/app/services/xokul/connection.rb @@ -11,11 +11,11 @@ module Connection def self.request(path, params: {}) response = RestClient.get( URI.join(BASE_URL, path).to_s, - header: { + headers: { Authorization: "Bearer #{BEARER_TOKEN}", 'Content-Type': 'application/json' }, - payload: params, + payload: params.to_json, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_PEER ) diff --git a/app/views/account/duties/_form.html.erb b/app/views/account/duties/_form.html.erb index 4402b7717..8c976e37b 100644 --- a/app/views/account/duties/_form.html.erb +++ b/app/views/account/duties/_form.html.erb @@ -16,7 +16,10 @@ <%= f.input :employee_id, collection: @user.employees, label_method: :title_name, required: true %>