Skip to content

Commit

Permalink
#254 adding a variable to enable or disable if professors can post gr…
Browse files Browse the repository at this point in the history
…ades -branch master-
  • Loading branch information
Carlos-Eduardo-Cabral-da-Cunha committed Nov 27, 2019
1 parent 0bda6df commit ad73185
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/models/custom_variable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class CustomVariable < ApplicationRecord
"redirect_email" => :text,
"notification_footer" => :text,
"minimum_grade_for_approval" => :text,
"grade_of_disapproval_for_absence" => :text
"grade_of_disapproval_for_absence" => :text,
"professor_login_can_post_grades" => :text
}

validates :variable, :presence => true
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20190809144853_add_new_custom_variable.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddNewCustomVariable < ActiveRecord::Migration[5.1]
def change
CustomVariable.where(:variable => "professor_login_can_post_grades").first or CustomVariable.create(:description=>"Professor logado no sistema pode lançar notas", :variable =>"professor_login_can_post_grades", :value => "no")
end
end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20180202200850) do
ActiveRecord::Schema.define(version: 20190809144853) do

create_table "accomplishments", force: :cascade do |t|
t.integer "enrollment_id"
Expand Down
1 change: 1 addition & 0 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
)
CustomVariable.create(:description=>"Nota mínima para aprovação", :variable =>"minimum_grade_for_approval", :value => "6.0")
CustomVariable.create(:description=>"Nota de reprovação por falta", :variable =>"grade_of_disapproval_for_absence", :value => "0.0")
CustomVariable.create(:description=>"Professor logado no sistema pode lançar notas", :variable =>"professor_login_can_post_grades", :value => "no")

['Graduação', 'Especialização', 'Mestrado', 'Doutorado'].each do |level|
Level.new do |l|
Expand Down

0 comments on commit ad73185

Please sign in to comment.