Skip to content

Commit

Permalink
STI checks - short version aces#969
Browse files Browse the repository at this point in the history
  • Loading branch information
MontrealSergiy committed Feb 1, 2024
1 parent 899a17f commit e3b46c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
7 changes: 2 additions & 5 deletions BrainPortal/lib/cbrain_system_checks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,9 @@ def self.a090_ensure_userfile_sti_enabled #:nodoc:

level = Rails.env.development? ? 'Warning' : 'Error'
not_loaded = Userfile.distinct.pluck(:type).select do |name|
name.safe_constantize.nil?
end.each do |name|
puts "C> \t- #{level}: Invalid STI type: " + name
p "C> \t- #{level}: Invalid STI type: " + name if name.safe_constantize.nil?
end
return if not_loaded.empty? || level == "Warning"
raise "The STI column of Userfile refer to invalid type(s)."
raise "Invalid type(s) in the STI column of Userfile." unless not_loaded.empty? || level == "Warning"
end


Expand Down
8 changes: 3 additions & 5 deletions BrainPortal/lib/portal_system_checks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,10 @@ def self.z020_ensure_task_sti_enabled #:nodoc:

level = Rails.env.development? ? 'Warning' : 'Error'
not_loaded = CbrainTask.distinct.pluck(:type).select do |name|
name.safe_constantize.nil?
end.each do |name|
puts "C> \t- #{level}: Invalid STI type: " + name
p "C> \t- #{level}: Invalid STI type: " + name if name.safe_constantize.nil?
end
return if not_loaded.empty? || level == "Warning"
raise "The STI column of CbrainTask refer to invalid type(s)."

raise "Invalid types in the STI column of CbrainTask" unless not_loaded.empty? || level == "Warning"
end
end

0 comments on commit e3b46c9

Please sign in to comment.