Class: Applicants::Applicant
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Applicants::Applicant
- Defined in:
- app/models/applicants/applicant.rb
Constant Summary collapse
- RESTART_REASONS =
%w(audio performance video)
- UNACCEPTABLE_TRANSITION_STATES_FOR_VIDEO_READY =
%w(approved rejected)
- VALID_EMAIL_REGEX =
/\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i.freeze
Instance Attribute Summary collapse
-
#event ⇒ Object
Returns the value of attribute event.
Instance Method Summary collapse
- #append_problem_to_notes(problem) ⇒ Object
- #fill_out_profile_url ⇒ Object
- #send_reminder ⇒ Object
- #set_custom_panel_info_in_notes ⇒ Object
- #set_timestamp(state) ⇒ Object
- #stale? ⇒ Boolean
- #unacceptable_transition_for_video_ready? ⇒ Boolean
- #very_stale? ⇒ Boolean
- #video_handle ⇒ Object
- #video_url ⇒ Object
Instance Attribute Details
#event ⇒ Object
Returns the value of attribute event.
7 8 9 |
# File 'app/models/applicants/applicant.rb', line 7 def event @event end |
Instance Method Details
#append_problem_to_notes(problem) ⇒ Object
156 157 158 159 |
# File 'app/models/applicants/applicant.rb', line 156 def append_problem_to_notes problem note = I18n.t("applicants.applicant.notes.restarted_for_problem", previous: notes, problem: problem, time: Time.now) update_attribute(:notes, note) end |
#fill_out_profile_url ⇒ Object
161 162 163 |
# File 'app/models/applicants/applicant.rb', line 161 def fill_out_profile_url "#{Rails.application.config.applicants_orders_base_url}/users/sign_up?email=#{CGI.escape email}" end |
#send_reminder ⇒ Object
165 166 167 |
# File 'app/models/applicants/applicant.rb', line 165 def send_reminder Applicants::ApplicantMailer.delay.upload_video_reminder(self.id) end |
#set_custom_panel_info_in_notes ⇒ Object
169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'app/models/applicants/applicant.rb', line 169 def set_custom_panel_info_in_notes return unless panel_id note = I18n.t("applicants.applicant.notes.signed_up_for_panel", panel: panel.remote_panel_id) if applicant_panel_parameter_set parameters = JSON.parse(applicant_panel_parameter_set.parameters) human_parameters = parameters.map{ |k,v| "#{k} = #{v}" }.join(", ") note = I18n.t("applicants.applicant.notes.with_params", note: note, params: human_parameters) end update_attribute(:notes, note) end |
#set_timestamp(state) ⇒ Object
152 153 154 |
# File 'app/models/applicants/applicant.rb', line 152 def state update_attribute(:"#{state}_at", Time.now) end |
#stale? ⇒ Boolean
54 55 56 |
# File 'app/models/applicants/applicant.rb', line 54 def stale? !!(reviewable_at && reviewable_at < 1.day.ago) end |
#unacceptable_transition_for_video_ready? ⇒ Boolean
62 63 64 |
# File 'app/models/applicants/applicant.rb', line 62 def unacceptable_transition_for_video_ready? UNACCEPTABLE_TRANSITION_STATES_FOR_VIDEO_READY.include? self.state end |
#very_stale? ⇒ Boolean
58 59 60 |
# File 'app/models/applicants/applicant.rb', line 58 def very_stale? !!(reviewable_at && reviewable_at < 2.days.ago) end |
#video_handle ⇒ Object
144 145 146 |
# File 'app/models/applicants/applicant.rb', line 144 def video_handle "applicant-#{id}" end |
#video_url ⇒ Object
148 149 150 |
# File 'app/models/applicants/applicant.rb', line 148 def video_url video.temporary_video_url if video end |