This repository has been archived by the owner on Jun 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #512 from omu/develop
Merge develop into master
- Loading branch information
Showing
62 changed files
with
799 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,7 @@ jobs: | |
key: nokul-yarn-{{ checksum "yarn.lock" }} | ||
paths: | ||
- node_modules/ | ||
rake_test: | ||
test_suite: | ||
<<: *ruby_2_5_1 | ||
steps: | ||
- restore_cache: | ||
|
@@ -108,8 +108,20 @@ jobs: | |
- run: bundle install | ||
- run: bin/yarn install | ||
- run: bundle exec rake quality:rails | ||
- run: bundle exec rake security:all | ||
- run: bin/yarn run lint | ||
security: | ||
<<: *ruby_2_5_1 | ||
steps: | ||
- restore_cache: | ||
<<: *repository | ||
- restore_cache: | ||
<<: *restore_bundle | ||
- restore_cache: | ||
<<: *restore_yarn | ||
- run: bundle --path vendor/bundle --without development | ||
- run: bundle install | ||
- run: bin/yarn install | ||
- run: bundle exec rake security:all | ||
deploy_develop: | ||
machine: | ||
enabled: true | ||
|
@@ -120,7 +132,7 @@ jobs: | |
command: | | ||
git remote add develop [email protected]:nokul-develop && | ||
git push develop develop:master | ||
deploy: | ||
deploy_master: | ||
machine: | ||
enabled: true | ||
steps: | ||
|
@@ -143,21 +155,28 @@ workflows: | |
- bundle_assets: | ||
requires: | ||
- bundle_dependencies | ||
- rake_test: | ||
- test_suite: | ||
requires: | ||
- bundle_assets | ||
- karma: | ||
requires: | ||
- bundle_assets | ||
- security: | ||
requires: | ||
- bundle_assets | ||
- deploy_develop: | ||
requires: | ||
- test_suite | ||
- karma | ||
- security | ||
filters: | ||
branches: | ||
only: develop | ||
- deploy: | ||
- deploy_master: | ||
requires: | ||
- test_suite | ||
- karma | ||
- security | ||
filters: | ||
branches: | ||
only: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
app/controllers/course_management/curriculum_semester_courses_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# frozen_string_literal: true | ||
|
||
module CourseManagement | ||
class CurriculumSemesterCoursesController < ApplicationController | ||
before_action :set_semester, only: %i[new create edit update destroy] | ||
before_action :set_semester_course, only: %i[edit update destroy] | ||
|
||
def new | ||
@semester_course = @semester.curriculum_semester_courses.new | ||
end | ||
|
||
def edit; end | ||
|
||
def create | ||
@semester_course = @semester.curriculum_semester_courses.new(semester_course_params) | ||
@semester_course.save ? redirect_with('success') : render(:new) | ||
end | ||
|
||
def update | ||
@semester_course.update(semester_course_params) ? redirect_with('success') : render(:edit) | ||
end | ||
|
||
def destroy | ||
message = @semester_course.destroy ? 'success' : 'error' | ||
redirect_with(message) | ||
end | ||
|
||
private | ||
|
||
def redirect_with(message) | ||
redirect_to curriculum_path(@semester.curriculum), flash: { notice: t(".#{message}") } | ||
end | ||
|
||
def set_semester_course | ||
@semester_course = @semester.curriculum_semester_courses.find(params[:id]) | ||
end | ||
|
||
def set_semester | ||
@semester = CurriculumSemester.find(params[:curriculum_semester_id]) | ||
end | ||
|
||
def semester_course_params | ||
params.require(:curriculum_semester_course).permit(:course_id, :ects) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
class CurriculumSemester < ApplicationRecord | ||
# relations | ||
has_many :curriculum_semester_courses, dependent: :destroy | ||
has_many :courses, through: :curriculum_semester_courses | ||
belongs_to :curriculum, counter_cache: :semesters_count, inverse_of: :semesters | ||
|
||
# validations | ||
validates :name, presence: true, uniqueness: { scope: :curriculum_id } | ||
validates :sequence, numericality: { greater_than: 0 }, uniqueness: { scope: :curriculum_id } | ||
|
||
# custom methods | ||
def available_courses(add_courses: []) | ||
courses = curriculum.unit.courses.active.where.not(id: curriculum.courses.ids) | ||
add_courses.compact! | ||
add_courses.present? ? (courses.to_a + add_courses) : courses | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
class CurriculumSemesterCourse < ApplicationRecord | ||
# relations | ||
belongs_to :course | ||
belongs_to :curriculum_semester | ||
|
||
# validations | ||
validates :ects, presence: true, numericality: { greater_than: 0 } | ||
|
||
# delegates | ||
delegate :code, :credit, :name, to: :course | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.