2020-01-31 10:52:53 +00:00
|
|
|
|
class SignUpSetting
|
|
|
|
|
include Mongoid::Document
|
|
|
|
|
include Mongoid::Timestamps
|
|
|
|
|
include OrbitModel::Status
|
|
|
|
|
include OrbitModel::Impression
|
|
|
|
|
# encoding: utf-8
|
|
|
|
|
include OrbitTag::Taggable
|
|
|
|
|
include OrbitCategory::Categorizable
|
|
|
|
|
field :start_year , type: String , default: Time.now.strftime("%Y")
|
|
|
|
|
field :end_year , type: String , default: Time.now.strftime("%Y")
|
|
|
|
|
field :start_month , type: String , default: Time.now.strftime("%m")
|
|
|
|
|
field :end_month , type: String , default: Time.now.strftime("%m")
|
|
|
|
|
field :start_day , type: String , default: Time.now.strftime("%d")
|
|
|
|
|
field :end_day , type: String , default: Time.now.strftime("%d")
|
|
|
|
|
field :start_o_clock , type: String , default: Time.now.strftime("%H")
|
|
|
|
|
field :end_o_clock , type: String , default: Time.now.strftime("%H")
|
|
|
|
|
field :start_minute , type: String , default: Time.now.strftime("%M")
|
|
|
|
|
field :end_minute , type: String , default: Time.now.strftime("%M")
|
|
|
|
|
field :default_password , type: String , default: ""
|
|
|
|
|
field :set_default_password , type: Boolean , default: false
|
2020-02-05 07:37:10 +00:00
|
|
|
|
field :remark_field , type: Hash , default: {:zh_tw=>"<strong><span style="font-size: 14pt"><span style="font-family: arial, helvetica, sans-serif">注意事項:</span></span></strong><span style="font-size: 14pt"><br />
|
|
|
|
|
請於<strong><span style="color: rgb(255,0,0)">2019年5月3日前</span></strong>(以郵戳為憑),將本報名表正本(需核章)以掛號方式郵寄至【<strong><span style="color: rgb(0,0,255)">11677台北市文山區汀州路4段88號科教中心,收件人: IJSO選訓委員會</span></strong>】,逾期概不受理報名。 <br />
|
|
|
|
|
<br type="_moz" />
|
|
|
|
|
</span><br />",:en=>""}
|
2020-01-31 10:52:53 +00:00
|
|
|
|
field :registration_instructions , type: Hash , default: {:zh_tw=>"",:en=>""}
|
2020-02-05 07:37:10 +00:00
|
|
|
|
field :active , type: Boolean , default: true
|
|
|
|
|
after_save :change_all_password , :check_active
|
2020-01-31 10:52:53 +00:00
|
|
|
|
def change_all_password
|
|
|
|
|
if self.set_default_password
|
|
|
|
|
OlympiaSchoolDataFields.all.each do |school_field|
|
|
|
|
|
school_field.password = self.default_password
|
|
|
|
|
school_field.save
|
|
|
|
|
end
|
|
|
|
|
self.set_default_password = false
|
|
|
|
|
self.save
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-02-05 07:37:10 +00:00
|
|
|
|
def check_active
|
|
|
|
|
if self.active
|
|
|
|
|
SignUpSetting.where.not(:id=>self.id).each do |setting|
|
|
|
|
|
setting.active = false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-01-31 10:52:53 +00:00
|
|
|
|
end
|