diff --git a/.codebeatsettings b/.codebeatsettings deleted file mode 100644 index 7ff72a765..000000000 --- a/.codebeatsettings +++ /dev/null @@ -1,5 +0,0 @@ -{ - "RUBY": { - "ABC": [15, 25, 50, 70] - } -} \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index d37f54432..51781aa6f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -51,7 +51,7 @@ GEM arel (9.0.0) ast (2.4.0) aws-eventstream (1.0.1) - aws-partitions (1.111.0) + aws-partitions (1.113.0) aws-sdk-core (3.38.0) aws-eventstream (~> 1.0) aws-partitions (~> 1.0) @@ -78,7 +78,7 @@ GEM bundler (~> 1.2) thor (~> 0.18) byebug (10.0.2) - capybara (3.10.1) + capybara (3.11.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -223,7 +223,7 @@ GEM rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) redis (4.0.3) - regexp_parser (1.2.0) + regexp_parser (1.3.0) responders (2.4.0) actionpack (>= 4.2.0, < 5.3) railties (>= 4.2.0, < 5.3) diff --git a/README.md b/README.md index cc84b7e8d..6ac8f534b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # Nokul -[![Beta](https://omu.sh/assets/badge/beta.svg)](https://omu.sh "BAUM Beta") [![CircleCI](https://circleci.com/gh/omu/nokul/tree/master.svg?style=svg&circle-token=a25e63abc0e1e6c074750d9b2ce5396e3e279d82)](https://circleci.com/gh/omu/nokul/tree/master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/06aecaa466ee4731aba08dbee43d74eb)](https://www.codacy.com?utm_source=github.com&utm_medium=referral&utm_content=omu/nokul&utm_campaign=Badge_Grade) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/06aecaa466ee4731aba08dbee43d74eb)](https://www.codacy.com?utm_source=github.com&utm_medium=referral&utm_content=omu/nokul&utm_campaign=Badge_Coverage) +[![Beta](https://omu.sh/assets/badge/beta.svg)](https://omu.sh "BAUM Beta") +[![CircleCI](https://circleci.com/gh/omu/nokul/tree/master.svg?style=svg&circle-token=a25e63abc0e1e6c074750d9b2ce5396e3e279d82)](https://circleci.com/gh/omu/nokul/tree/master) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/06aecaa466ee4731aba08dbee43d74eb)](https://www.codacy.com?utm_source=github.com&utm_medium=referral&utm_content=omu/nokul&utm_campaign=Badge_Grade) +[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/06aecaa466ee4731aba08dbee43d74eb)](https://www.codacy.com?utm_source=github.com&utm_medium=referral&utm_content=omu/nokul&utm_campaign=Badge_Coverage) +[![security](https://hakiri.io/projects/cf546402fb7117/stacks/622121c74c17f4/622121c74c17f4.svg?repo_token=xo-yGdqDKXvCf-jypXd-)](https://hakiri.io/projects/cf546402fb7117/stacks/622121c74c17f4/shield) [Nokul](https://github.com/omu/nokul) aims to become a complete solution for universities that face many challanges while trying to manage all the complex procedures of a university online. diff --git a/app/models/available_course.rb b/app/models/available_course.rb index 7ba166cb9..5f0a30555 100644 --- a/app/models/available_course.rb +++ b/app/models/available_course.rb @@ -6,4 +6,7 @@ class AvailableCourse < ApplicationRecord belongs_to :curriculum belongs_to :course has_many :groups, class_name: 'AvailableCourseGroup', dependent: :destroy + + # validations + validates :course, uniqueness: { scope: %i[academic_term curriculum] } end diff --git a/app/models/available_course_lecturer.rb b/app/models/available_course_lecturer.rb index aa89450f9..400bde9f7 100644 --- a/app/models/available_course_lecturer.rb +++ b/app/models/available_course_lecturer.rb @@ -6,7 +6,8 @@ class AvailableCourseLecturer < ApplicationRecord belongs_to :lecturer, class_name: 'Employee' # validations - validates :coordinator, presence: true, inclusion: { in: [true, false] } + validates :coordinator, inclusion: { in: [true, false] } + validates :lecturer, uniqueness: { scope: :group } # scopes scope :coordinator, -> { where(coordinator: true) } diff --git a/app/views/account/duties/_form.html.erb b/app/views/account/duties/_form.html.erb index c1aec9650..23fe3d6af 100644 --- a/app/views/account/duties/_form.html.erb +++ b/app/views/account/duties/_form.html.erb @@ -40,3 +40,5 @@ + +<%= render 'select2' %> \ No newline at end of file diff --git a/app/views/account/duties/_select2.html.erb b/app/views/account/duties/_select2.html.erb new file mode 100644 index 000000000..4f824f8be --- /dev/null +++ b/app/views/account/duties/_select2.html.erb @@ -0,0 +1,5 @@ + diff --git a/app/views/account/employees/_form.html.erb b/app/views/account/employees/_form.html.erb index 2e7261bd9..144871bfe 100644 --- a/app/views/account/employees/_form.html.erb +++ b/app/views/account/employees/_form.html.erb @@ -29,3 +29,5 @@ + +<%= render 'select2' %> \ No newline at end of file diff --git a/app/views/account/employees/_select2.html.erb b/app/views/account/employees/_select2.html.erb new file mode 100644 index 000000000..4651f7513 --- /dev/null +++ b/app/views/account/employees/_select2.html.erb @@ -0,0 +1,5 @@ + diff --git a/app/views/account/positions/_form.html.erb b/app/views/account/positions/_form.html.erb index f695b2e3d..274d18290 100644 --- a/app/views/account/positions/_form.html.erb +++ b/app/views/account/positions/_form.html.erb @@ -34,3 +34,5 @@ + +<%= render 'select2' %> \ No newline at end of file diff --git a/app/views/account/positions/_select2.html.erb b/app/views/account/positions/_select2.html.erb new file mode 100644 index 000000000..a177f8e31 --- /dev/null +++ b/app/views/account/positions/_select2.html.erb @@ -0,0 +1,5 @@ + diff --git a/app/views/calendar/academic_calendars/_calendar_event_fields.erb b/app/views/calendar/academic_calendars/_calendar_event_fields.erb index 578cf232e..d297e3fba 100644 --- a/app/views/calendar/academic_calendars/_calendar_event_fields.erb +++ b/app/views/calendar/academic_calendars/_calendar_event_fields.erb @@ -1,7 +1,7 @@
- <%= f.input :calendar_title_id, collection: @academic_calendar.calendar_type.titles %> + <%= f.input :calendar_title_id, collection: @academic_calendar.calendar_type.titles, input_html: { class: 'select_search_class' } %> <%= f.input :start_date, start_year: 2005 %> <%= f.input :end_date, start_year: 2005, include_blank: true %>
@@ -10,3 +10,5 @@
+ +<%= render 'select2' %> \ No newline at end of file diff --git a/app/views/calendar/academic_calendars/_select2.html.erb b/app/views/calendar/academic_calendars/_select2.html.erb new file mode 100644 index 000000000..0389fbd11 --- /dev/null +++ b/app/views/calendar/academic_calendars/_select2.html.erb @@ -0,0 +1,5 @@ + diff --git a/app/views/course_management/course_unit_groups/_form.html.erb b/app/views/course_management/course_unit_groups/_form.html.erb index 019dbdee7..4927fd40c 100644 --- a/app/views/course_management/course_unit_groups/_form.html.erb +++ b/app/views/course_management/course_unit_groups/_form.html.erb @@ -18,7 +18,9 @@ <%= f.input :total_ects_condition, required: true, input_html: { min: 0 } %>
- <%= f.association :unit, collection: Unit.active.without_programs.order(:name) %> + <%= f.association :unit, + collection: Unit.active.without_programs.order(:name), + label_method: :names_depth_cache %>
<%= f.association :course_group_type %> diff --git a/app/views/course_management/course_unit_groups/_js.html.erb b/app/views/course_management/course_unit_groups/_js.html.erb index 0235dd545..8a8c33b89 100644 --- a/app/views/course_management/course_unit_groups/_js.html.erb +++ b/app/views/course_management/course_unit_groups/_js.html.erb @@ -1,6 +1,6 @@ diff --git a/app/views/references/countries/show.html.erb b/app/views/references/countries/show.html.erb index 7bfc8c138..b1933794b 100644 --- a/app/views/references/countries/show.html.erb +++ b/app/views/references/countries/show.html.erb @@ -13,7 +13,7 @@ - + diff --git a/app/views/units/_select2.html.erb b/app/views/units/_select2.html.erb index ca3591169..788003782 100644 --- a/app/views/units/_select2.html.erb +++ b/app/views/units/_select2.html.erb @@ -1,6 +1,7 @@ diff --git a/config/locales/models/references/en.yml b/config/locales/models/references/en.yml index efb71d894..bef05b831 100644 --- a/config/locales/models/references/en.yml +++ b/config/locales/models/references/en.yml @@ -51,7 +51,7 @@ en: update: success: City successfully updated. common: - countries: Ülkeler + countries: Countries countries: create: success: Country successfully created. diff --git a/doc/development/app-upgrade.md b/doc/development/app-upgrade.md index 1e552108d..fb7dd30bc 100644 --- a/doc/development/app-upgrade.md +++ b/doc/development/app-upgrade.md @@ -1,6 +1,6 @@ # App Upgrade -**Run only if you know what you are doing!** +Bu işlem yalnızca repository yöneticileri tarafından gerçekleştirilebilir: ```bash bin/rails app:update diff --git a/doc/development/third-parties.md b/doc/development/third-parties.md index e41ecfa00..8f39489fd 100644 --- a/doc/development/third-parties.md +++ b/doc/development/third-parties.md @@ -1,3 +1,3 @@ # APIs and Integrations -Third-party integrations are located under `app/services/foo/v1`. Follow up /docs subfolder (ie. `app/services/foo/v1/docs` for SOAPUI templates. +Third-party integrations are located under `app/services/SERVICE_NAME/ENDPOINT`. diff --git a/doc/git/authoring.md b/doc/git/authoring.md new file mode 100644 index 000000000..bcb7bab4a --- /dev/null +++ b/doc/git/authoring.md @@ -0,0 +1,20 @@ +# Authoring + +## Bir Başkasının Çalışmasını Commit'lemek + +Bir başkasının çalışmasını herhangi bir sebeple siz commit'liyorsanız, çalışmayı gerçekleştiren kişi ilgili commit'lerde author olarak atanmalıdır: + +``` +git commit --author="John Doe " +``` + +## Ortaklaşa Yazılan Dokümanlar + +Ortaklaşa yazılan herhangi bir dokümanı commit'lerken markdown dosyasına meta veri olarak author ve co-author bilgisi girilmelidir. Örneğin: + +``` +--- +author: Recai Oktaş +co-author: M. Serhat Dündar +--- +``` diff --git a/test/fixtures/available_course_groups.yml b/test/fixtures/available_course_groups.yml index 7deb2acdf..f781adb47 100644 --- a/test/fixtures/available_course_groups.yml +++ b/test/fixtures/available_course_groups.yml @@ -2,3 +2,7 @@ ati_group_1: available_course: ati_fall_2017_2018 name: Group 1 quota: 10 +ati_fall_2017_2018: + available_course: ati_fall_2017_2018 + name: Group 2 + quota: 10 diff --git a/test/models/course/available_course_lecturer_test.rb b/test/models/course/available_course_lecturer_test.rb index 9c8344d76..12b5e1137 100644 --- a/test/models/course/available_course_lecturer_test.rb +++ b/test/models/course/available_course_lecturer_test.rb @@ -3,27 +3,39 @@ require 'test_helper' class AvailableCourseLecturerTest < ActiveSupport::TestCase + setup do + @course_lecturer = available_course_lecturers(:ati_group_1_lecturer_john) + end + # relations %i[ group lecturer ].each do |property| test "a available_course_lecturer can communicate with #{property}" do - assert available_course_lecturers(:ati_group_1_lecturer_john).send(property) + assert @course_lecturer.send(property) end end # validations: presence test 'should not save available_course_group without coordinator info' do - available_course_lecturers(:ati_group_1_lecturer_john).coordinator = nil - assert_not available_course_lecturers(:ati_group_1_lecturer_john).valid? - assert_not_empty available_course_lecturers(:ati_group_1_lecturer_john).errors[:coordinator] + @course_lecturer.coordinator = nil + assert_not @course_lecturer.valid? + assert_not_empty @course_lecturer.errors[:coordinator] + end + + # validations: uniqueness + test 'uniqueness validations for lecturer of a group' do + fake = @course_lecturer.dup + assert_not fake.valid? + assert_not_empty fake.errors[:lecturer] + fake.group = available_course_groups(:ati_fall_2017_2018) + assert fake.valid? end # scopes test 'coordinator scope returns coordinator lecturers' do - lecturers = available_course_groups(:ati_group_1).lecturers - assert lecturers.coordinator.to_a.include?(available_course_lecturers(:ati_group_1_lecturer_john)) - assert_not lecturers.coordinator.to_a.include?(available_course_lecturers(:ati_group_1_lecturer_serhat)) + assert_includes AvailableCourseLecturer.coordinator, @course_lecturer + assert_not_includes AvailableCourseLecturer.coordinator, available_course_lecturers(:ati_group_1_lecturer_serhat) end end diff --git a/test/models/course/available_course_test.rb b/test/models/course/available_course_test.rb index 17f247cb7..ba86c567e 100644 --- a/test/models/course/available_course_test.rb +++ b/test/models/course/available_course_test.rb @@ -14,4 +14,16 @@ class AvailableCourseTest < ActiveSupport::TestCase assert available_courses(:ati_fall_2017_2018).send(property) end end + + # validations: uniqueness + test 'uniqueness validations for course of a academic term and curriculum' do + fake = available_courses(:ati_fall_2017_2018).dup + assert_not fake.valid? + assert_not_empty fake.errors[:course] + fake.academic_term = academic_terms(:spring_2017_2018) + assert fake.valid? + fake.academic_term = academic_terms(:fall_2017_2018) + fake.curriculum = curriculums(:two) + assert fake.valid? + end end
<%= t('.name') %><%= t('activerecord.attributes.country.name') %> <%= @country.name %>