Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #502 from omu/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
msdundar authored Nov 6, 2018
2 parents 7c27514 + 2934eb6 commit 9c14321
Show file tree
Hide file tree
Showing 26 changed files with 691 additions and 104 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ group :test do
gem 'chromedriver-helper'
gem 'codacy-coverage', require: false
gem 'selenium-webdriver'
gem 'webmock'
end

group :development do
Expand Down
63 changes: 33 additions & 30 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ 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)
jmespath (~> 1.0)
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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -124,16 +126,17 @@ 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)
mini_magick (~> 4.0)
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)
Expand All @@ -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)
Expand All @@ -168,22 +171,22 @@ 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)
activerecord (>= 4.2)
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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -293,14 +291,18 @@ 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)
actionview (>= 5.0)
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)
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion app/models/prospective_student.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 13 additions & 12 deletions app/models/unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,26 @@ 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

# callbacks
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
Expand Down
7 changes: 6 additions & 1 deletion app/models/unit_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions app/services/xokul/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
5 changes: 4 additions & 1 deletion app/views/account/duties/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
<%= f.input :employee_id, collection: @user.employees, label_method: :title_name, required: true %>
</div>
<div class='form-group col-sm-4'>
<%= f.input :unit_id, collection: Unit.all, required: true %>
<%= f.input :unit_id,
collection: Unit.active.without_programs.order(:name),
required: true,
label_method: lambda { |unit| "#{unit.name} (#{unit.parent.try(:name)})" } %>
</div>
<div class='form-group col-sm-4'>
<%= f.input :start_date, required: true %>
Expand Down
3 changes: 2 additions & 1 deletion app/views/account/employees/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
</div>
<div class='form-group col-sm-4'>
<%= f.input :title_id, collection: Title.all, required: true %>
<%= f.input :title_id, collection: Title.order(:name), required: true,
label_method: lambda { |title| title.name + ' - ' + title.branch } %>
</div>
<div class='form-group col-sm-12'>
<%= f.input :active %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/account/positions/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<%= f.input :duty_id, collection: @user.duties, label_method: :unit_name, required: true %>
</div>
<div class='form-group col-sm-4'>
<%= f.input :administrative_function_id, collection: AdministrativeFunction.all, required: true %>
<%= f.input :administrative_function_id, collection: AdministrativeFunction.order(:name), required: true %>
</div>
<div class='form-group col-sm-4'>
<%= f.input :start_date, required: true %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<td><%= prospective_student.meb_status ? t('.graduated') : t('.not_graduated_or_unknown') %></td>
<td><%= prospective_student.military_status ? t('.unproblematic') : t('.must_see_recruiting_office') %></td>
<td><%= prospective_student.obs_status ? t('.unproblematic') : t('.student_in_a_different_unit') %></td>
<td><%= prospective_student.student_entrance_type.name %></td>
<td><%= prospective_student.student_entrance_type.try(:name) %></td>
<td>
<%= link_to_show(prospective_student_path(prospective_student)) %>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<tbody>
<tr>
<td><%= t('.student_entrance_type') %></td>
<td><%= @prospective_student.student_entrance_type.name %></td>
<td><%= @prospective_student.student_entrance_type.try(:name) %></td>
</tr>
<tr>
<td><%= t('.unit') %></td>
Expand Down
8 changes: 6 additions & 2 deletions app/views/units/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<%= f.association :unit_instruction_type %>
</div>
<div class='form-group col-sm-6'>
<%= f.input :duration,collection: 1..8 %>
<%= f.input :duration, collection: 1..8 %>
</div>
<div class='form-group col-sm-6'>
<%= f.association :unit_type %>
Expand All @@ -43,7 +43,11 @@
<%= f.association :district, collection: City.includes(:districts).order(:name), as: :grouped_select, group_method: :districts, group_label_method: :name, input_html: { id: 'district_list' } %>
</div>
<div class='form-group col-sm-6'>
<%= f.input :parent_id, as: :select, collection: Unit.all.order('name ASC'), input_html: { id: 'parent_unit_list' } %>
<%= f.input :parent_id, as: :select,
collection: Unit.partially_passive.or(Unit.active).order(:name),
input_html: { id: 'parent_unit_list' },
label_method: lambda {|unit| "#{unit.name} (#{unit.parent.try(:name)})"}
%>
</div>
<div class='form-group col-sm-12'>
<%= f.button :submit, class: 'btn btn-outline-success btn-sm' %>
Expand Down
2 changes: 1 addition & 1 deletion config/locales/models/student_management/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ en:
turkish: Turkish Citizen
placement_types:
additional_score: Additional Scored
general: General
general_score: General
simple_form:
labels:
prospective_student:
Expand Down
2 changes: 1 addition & 1 deletion config/locales/models/student_management/tr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ tr:
turkish: Türk Vatandaşı
placement_types:
additional_score: Ek Puanlı
general: Genel
general_score: Genel
simple_form:
labels:
prospective_student:
Expand Down
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.datetime "password_changed_at", default: -> { "now()" }, null: false
t.datetime "password_changed_at", default: -> { "CURRENT_TIMESTAMP" }, null: false
t.string "slug", limit: 255
t.string "preferred_language", limit: 2, default: "tr"
t.integer "articles_count", default: 0, null: false
Expand Down
Loading

0 comments on commit 9c14321

Please sign in to comment.