Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • portalmec/portalmec
  • rfhferreira/cleanning-portalmec
2 results
Show changes
Showing
with 522 additions and 84 deletions
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
# == Schema Information
#
# Table name: learning_object_attachments
......@@ -22,12 +41,18 @@
# cache_link :string
#
class LearningObject::Attachment < ActiveRecord::Base
class LearningObject::Attachment < ApplicationRecord
include ::Thumbnailable
belongs_to :learning_object
scope :unknown_mime_type, ->() { where(format: 'Unknown') }
has_one :learning_object_attachment, as: :learning_object_attachment_id_son
belongs_to :learning_object_attachment, optional: true
def retrieve_url
return retrieve_link if bundle_name == "ORE" || bundle_name == "LINK"
return retrieve_link.sub("public", "") if bundle_name == "TEMP"
return "#{DspaceService.link}#{retrieve_link}" if retrieve_link.include? "rest"
"#{DspaceService.link}/rest#{retrieve_link}"
end
......
# == Schema Information
#
# Table name: learning_objects
#
# id :integer not null, primary key
# id_dspace :integer
# name :string
# author :string
# description :text
# published_at :datetime
# score :float default("0.0")
# school_level :integer
# metadata :jsonb default("{}")
# keywords :text
# publisher_id :integer
# publisher_type :string
# language_id :integer
# object_type_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# views_count :integer default("0")
# downloads_count :integer default("0")
# likes_count :integer default("0")
# shares_count :integer default("0")
# state :string default("published")
# thumbnail_file_name :string
# thumbnail_content_type :string
# thumbnail_file_size :integer
# thumbnail_updated_at :datetime
# attachment_id :integer
#
class LearningObject::Draft < LearningObject
##overwrites initialize method to force @state value as draft
def initialize(attributes = nil, options = {})
super(attributes, options)
@state = 'draft'
end
end
class License < ActiveRecord::Base
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
class License < ApplicationRecord
validates :name, presence: true
end
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
# == Schema Information
#
# Table name: likes
......@@ -10,14 +29,18 @@
# updated_at :datetime not null
#
class Like < ActiveRecord::Base
class Like < ApplicationRecord
# *current_user* likes *likeable*
# *current_user* unlikes *likeable*
include Trackable
belongs_to :likeable, polymorphic: true, counter_cache: true
belongs_to :user
belongs_to :user, counter_cache: true
validates_presence_of :user, :likeable
validates :user_id, uniqueness: { scope: [:likeable_id, :likeable_type] }
def recipient
likeable
end
end
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
# == Schema Information
#
# Table name: mime_types
......@@ -7,6 +26,6 @@
# mime_type :string
#
class MimeType < ActiveRecord::Base
class MimeType < ApplicationRecord
has_and_belongs_to_many :object_types
end
class ObjectType < ActiveRecord::Base
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
class ObjectType < ApplicationRecord
has_many :learning_objects
has_and_belongs_to_many :mime_types
has_and_belongs_to_many :searches
validates_presence_of :name
validates_uniqueness_of :name
......
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
# == Schema Information
#
# Table name: packages
#
# package_items_id integer
# created_at datetime null: false
# updated_at datetime null: false
# file_path string
class Package < ApplicationRecord
has_many :package_items, dependent: :destroy
validates_presence_of :file_path
def add_items(items)
items.each do |item|
package_item = PackageItem.where(package: self, packageable: item).first_or_create
end
end
end
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
# == Schema Information
#
# Table name: package_items
#
# package_id integer
# packageable_type string
# packageable_id integer
# created_at datetime null: false
# updated_at datetime null: false
class PackageItem < ApplicationRecord
belongs_to :package
belongs_to :packageable, polymorphic: true
validates :package, :packageable, presence: true
end
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
# == Schema Information
#
# Table name: questions
# t.string "description"
# t.integer "status", default: 0
# t.datetime "created_at", null: false
# t.datetime "updated_at", null: false
class Question < ApplicationRecord
enum status: [:inactive, :active]
has_many :answers
has_many :submissions, through: :answers
end
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
# == Schema Information
#
# Table name: rates
......@@ -8,7 +27,7 @@
# review_id :integer
# created_at :datetime not null
# updated_at :datetime not null
class Rate < ActiveRecord::Base
class Rate < ApplicationRecord
# *current_user* rate a review *review*
include Trackable
......@@ -20,9 +39,13 @@ class Rate < ActiveRecord::Base
validates_uniqueness_of :user, scope: :review
validate :cannot_rate_your_own, on: :create
def recipient
review
end
private
def cannot_rate_your_own
errors.add(:user_id, "cannot rate your own review") if review.user == user
errors.add(:user_id, 'cannot rate your own review') if review.user == user
end
end
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
# == Schema Information
#
# Table name: ratings
......@@ -9,7 +28,7 @@
# description :string
#
class Rating < ActiveRecord::Base
has_many :review_ratings
class Rating < ApplicationRecord
has_many :review_ratings, dependent: :destroy
has_many :reviews, through: :review_ratings
end
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
# == Schema Information
#
# Table name: reviews
......@@ -15,9 +34,13 @@
# rates_count :integer default("0")
#
class Review < ActiveRecord::Base
class Review < ApplicationRecord
# *current_user* review *reviewable*
include Trackable
include Complainable
after_save :calculate_review_rate
after_destroy :calculate_review_rate
belongs_to :reviewable, polymorphic: true
belongs_to :user
......@@ -25,39 +48,52 @@ class Review < ActiveRecord::Base
has_many :review_ratings
has_many :ratings, through: :review_ratings
has_many :rates
has_many :complaints, as: :complaintable
validates_presence_of :user, :reviewable, :review_ratings
validates_presence_of :user, :reviewable
validates_inclusion_of :reviewable_type, in: %w(LearningObject Collection), message: 'Only LearningObjects and Collections are reviewable.'
validates_uniqueness_of :user, scope: [:reviewable_id, :reviewable_type]
accepts_nested_attributes_for :review_ratings
default_scope { includes(:user) }
acts_as_paranoid
has_paper_trail
def rating_values
review_ratings.includes(:rating).map { |r| {rating: r.rating, value: r.value} }
review_ratings.includes(:rating).map { |r| { rating: r.rating, value: r.value } }
end
def rating_average
return 0.0 if review_ratings.empty?
review_ratings.average(:value).floor(1).to_f
end
def rates_percentage
return false if rates.count < 5
return 0.0 if rates.count < 5
approved = rates.where(approves: true).count
(approved.to_f / rates.count.to_f) * 100
end
def rated? (user)
!Rate.where(user: user, review: self).first.nil?
def rated?(user)
!Rate.find_by(user: user, review: self).nil?
end
def user_approves? (user)
return Rate.where(user: user, review: self).first.approves if rated? user
def user_approves?(user)
return Rate.find_by(user: user, review: self).approves if rated? user
nil
end
def recipient
reviewable
end
private
def calculate_review_rate
if !reviewable.nil?
reviewable.review_average = reviewable.review_ratings_average
reviewable.save
end
# ReviewAverageCalculatorWorker.perform_in(1.minutes, reviewable.id, reviewable.class.name)
end
end
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
# == Schema Information
#
# Table name: review_ratings
......@@ -10,11 +29,11 @@
# updated_at :datetime not null
#
class ReviewRating < ActiveRecord::Base
class ReviewRating < ApplicationRecord
belongs_to :review
belongs_to :rating
validates_inclusion_of :value, in: Array(1..5), message: "Review Rating must be between 1 and 5."
validates_inclusion_of :value, in: Array(1..5), message: 'Review Rating must be between 1 and 5.'
validates_presence_of :rating
validates_uniqueness_of :rating, scope: :review
......
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
# == Schema Information
#
# Table name: roles
......@@ -9,25 +28,50 @@
# updated_at :datetime not null
#
class Role < ActiveRecord::Base
class Role < ApplicationRecord
has_and_belongs_to_many :users
has_and_belongs_to_many :emails
validates_presence_of :name
validates_uniqueness_of :name
validates :name, presence: true, uniqueness: true
def self.admin
self.find_by_name('admin') || self.create!(name: 'admin')
find_by(name: 'admin') || create!(name: 'admin')
end
def self.teacher
self.find_by_name('teacher') || self.create!(name: 'teacher')
find_by(name: 'teacher') || create!(name: 'teacher')
end
def self.student
self.find_by_name('student') || self.create!(name: 'student')
find_by(name: 'student') || create!(name: 'student')
end
def self.curator
self.find_by_name('curator') || self.create!(name: 'curator')
find_by(name: 'curator') || create!(name: 'curator')
end
def self.moderator
find_by(name: 'moderator') || create!(name: 'moderator')
end
def self.editor
find_by(name: 'editor') || create!(name: 'editor')
end
def self.supervisor
find_by(name: 'supervisor') || create!(name: 'supervisor')
end
def self.submitter
find_by(name: 'submitter') || create!(name: 'submitter')
end
def self.partner
find_by(name: 'partner') || create!(name: 'partner')
end
def self.publisher
find_by(name: 'publisher') || create!(name: 'publisher')
end
end
class School < ApplicationRecord
has_many :users
validates :inep_id, presence: true, uniqueness: true
validates :name, :phone, :uf, :city, presence: true
end
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
# == Schema Information
#
# Table name: scores
......@@ -12,7 +31,7 @@
# score_type :string default("{}"), is an Array
#
class Score < ActiveRecord::Base
class Score < ApplicationRecord
has_many :score_user_categories
has_many :user_categories, through: :score_user_categories
......@@ -24,10 +43,12 @@ class Score < ActiveRecord::Base
has_paper_trail
def max_value
score_user_categories.maximum(:value)
Rails.cache.fetch("#{cache_key}/max_value", expires_in: 23.hours) do
score_user_categories.maximum(:value)
end
end
def category_values(category)
score_user_categories.find { |x| x.score_id == id && x.user_category_id == category.id }.map {|x| [x.code, x.value] }.to_h
score_user_categories.find { |x| x.score_id == id && x.user_category_id == category.id }.map { |x| [x.code, x.value] }.to_h
end
end
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
# == Schema Information
#
# Table name: score_user_categories
......@@ -10,7 +29,7 @@
# updated_at :datetime not null
#
class ScoreUserCategory < ActiveRecord::Base
class ScoreUserCategory < ApplicationRecord
belongs_to :score
belongs_to :user_category
......
class Search
include ActiveModel::Model
attr_accessor :page, :results_per_page, :order, :query, :search_class, :tags, :types
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
class Search < ApplicationRecord
attr_accessor :page, :results_per_page, :order, :tags, :and_fields
belongs_to :user, optional: true
has_and_belongs_to_many :tags
has_and_belongs_to_many :subjects
has_and_belongs_to_many :educational_stages
has_and_belongs_to_many :object_types
has_and_belongs_to_many :language
validates_presence_of :query, :results_per_page, :order, :search_class
validates_numericality_of :results_per_page, greater_than: 0
validates :search_class, inclusion: { in: ::SearchService::SEARCH_CLASSES }
alias_attribute :subjects, :subject_ids
alias_attribute :educational_stages, :educational_stage_ids
alias_attribute :object_types, :object_type_ids
alias_attribute :languages, :language_ids
def initialize(params = {})
super(defaults.merge(params.select { |key, _value| respond_to? key }))
super(params.merge(defaults(params)))
end
def learning_object?
......@@ -24,12 +52,13 @@ class Search
private
def defaults
def defaults(params)
{
query: '*',
order: 'score',
page: 1,
results_per_page: 10
}
page: 0,
results_per_page: 10,
and_fields: []
}.select { |key, _value| !params.key?(key) }
end
end
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
# == Schema Information
#
# Table name: shares
......@@ -10,7 +29,7 @@
# updated_at :datetime not null
#
class Share < ActiveRecord::Base
class Share < ApplicationRecord
# *current_user* shares *shareable*
include Trackable
......@@ -18,4 +37,8 @@ class Share < ActiveRecord::Base
belongs_to :user
validates_presence_of :user, :shareable
def recipient
shareable
end
end
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
class StageRelation < ApplicationRecord
belongs_to :educational_stage
belongs_to :stageable, polymorphic: true
validates_presence_of :stageable, :educational_stage
end