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 #554 from omu/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
msdundar authored Nov 16, 2018
2 parents 8fc0b75 + 8d10ec8 commit 3bea9fa
Show file tree
Hide file tree
Showing 25 changed files with 109 additions and 27 deletions.
5 changes: 0 additions & 5 deletions .codebeatsettings

This file was deleted.

6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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&amp;utm_medium=referral&amp;utm_content=omu/nokul&amp;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&amp;utm_medium=referral&amp;utm_content=omu/nokul&amp;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.

Expand Down
3 changes: 3 additions & 0 deletions app/models/available_course.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion app/models/available_course_lecturer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
2 changes: 2 additions & 0 deletions app/views/account/duties/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@
</div>
</div>
</div>

<%= render 'select2' %>
5 changes: 5 additions & 0 deletions app/views/account/duties/_select2.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script type='text/javascript'>
$(document).ready(function() {
$('#duty_unit_id').select2();
});
</script>
2 changes: 2 additions & 0 deletions app/views/account/employees/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@
</div>
</div>
</div>

<%= render 'select2' %>
5 changes: 5 additions & 0 deletions app/views/account/employees/_select2.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script type='text/javascript'>
$(document).ready(function() {
$('#employee_title_id').select2();
});
</script>
2 changes: 2 additions & 0 deletions app/views/account/positions/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@
</div>
</div>
</div>

<%= render 'select2' %>
5 changes: 5 additions & 0 deletions app/views/account/positions/_select2.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script type='text/javascript'>
$(document).ready(function() {
$('#position_administrative_function_id, #position_duty_id').select2();
});
</script>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class='nested-fields'>
<div class='card card-default'>
<div class='card-body bg-light'>
<%= 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 %>
</div>
Expand All @@ -10,3 +10,5 @@
</div>
</div>
</div>

<%= render 'select2' %>
5 changes: 5 additions & 0 deletions app/views/calendar/academic_calendars/_select2.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script type='text/javascript'>
$(document).ready(function() {
$('.select_search_class').select2();
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
<%= f.input :total_ects_condition, required: true, input_html: { min: 0 } %>
</div>
<div class='form-group col-sm-6'>
<%= 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 %>
</div>
<div class='form-group col-sm-6'>
<%= f.association :course_group_type %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script type='text/javascript'>
$(document).ready(function() {
$('#course_unit_group_unit_id').select2();
$('#course_unit_group_unit_id, #course_unit_group_course_group_type_id').select2();
$('#course_unit_group_course_ids').select2({
multiple: true
});
Expand Down
2 changes: 1 addition & 1 deletion app/views/course_management/courses/_select2.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script type='text/javascript'>
$(document).ready(function() {
$('#course_unit_id, #course_program_type, #course_status, #course_language').select2();
$('#course_unit_id, #course_program_type, #course_status, #course_language_id').select2();
});
</script>
2 changes: 1 addition & 1 deletion app/views/references/countries/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<table class="table table-responsive-sm">
<tbody>
<tr>
<td><%= t('.name') %></td>
<td><%= t('activerecord.attributes.country.name') %></td>
<td><%= @country.name %></td>
</tr>
<tr>
Expand Down
5 changes: 3 additions & 2 deletions app/views/units/_select2.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script type="text/javascript">
$(document).ready(function() {
$('#district_list').select2();
$('#parent_unit_list').select2();
$('#unit_unit_instruction_language_id, #unit_unit_status_id').select2();
$('#unit_unit_instruction_type_id, #unit_duration').select2();
$('#unit_unit_type_id, #district_list, #parent_unit_list').select2();
});
</script>
2 changes: 1 addition & 1 deletion config/locales/models/references/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ en:
update:
success: City successfully updated.
common:
countries: Ülkeler
countries: Countries
countries:
create:
success: Country successfully created.
Expand Down
2 changes: 1 addition & 1 deletion doc/development/app-upgrade.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/development/third-parties.md
Original file line number Diff line number Diff line change
@@ -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`.
20 changes: 20 additions & 0 deletions doc/git/authoring.md
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
```

## 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
---
```
4 changes: 4 additions & 0 deletions test/fixtures/available_course_groups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 19 additions & 7 deletions test/models/course/available_course_lecturer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 12 additions & 0 deletions test/models/course/available_course_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3bea9fa

Please sign in to comment.