2016-09-24 03:00:46 +00:00
|
|
|
# frozen_string_literal: true
|
2016-02-03 13:38:41 +00:00
|
|
|
class UserPreference
|
2016-09-18 15:22:51 +00:00
|
|
|
attr_accessor :metacodes, :metacode_focus
|
2016-07-26 00:14:23 +00:00
|
|
|
|
2016-02-03 13:38:41 +00:00
|
|
|
def initialize
|
|
|
|
array = []
|
2016-09-10 00:36:49 +00:00
|
|
|
%w(Action Aim Idea Question Note Wildcard Subject).each do |m|
|
2016-09-21 17:22:40 +00:00
|
|
|
begin
|
2017-01-24 00:30:13 +00:00
|
|
|
metacode = Metacode.find_by(name: m)
|
2016-09-21 17:22:40 +00:00
|
|
|
array.push(metacode.id.to_s) if metacode
|
|
|
|
rescue ActiveRecord::StatementInvalid
|
|
|
|
if m == 'Action'
|
2016-09-24 03:00:46 +00:00
|
|
|
Rails.logger.warn('TODO: remove this travis workaround in user_preference.rb')
|
2016-09-21 17:22:40 +00:00
|
|
|
end
|
|
|
|
end
|
2016-02-03 13:38:41 +00:00
|
|
|
end
|
|
|
|
@metacodes = array
|
2016-09-18 15:22:51 +00:00
|
|
|
@metacode_focus = array[0]
|
2016-02-03 13:38:41 +00:00
|
|
|
end
|
2016-07-26 00:14:23 +00:00
|
|
|
end
|