Class: Fe::ReferenceSheet
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Fe::ReferenceSheet
- Includes:
- AASM, AccessKeyGenerator, AnswerSheetConcern
- Defined in:
- app/models/fe/reference_sheet.rb
Instance Method Summary collapse
- #display_type ⇒ Object
- #email_sent? ⇒ Boolean
- #frozen? ⇒ Boolean
- #name ⇒ Object
-
#question_sheet ⇒ Object
Can’t rely on answer_sheet’s implementation for old reference’s that might have id’s that may match an application id.
- #question_sheet_ids ⇒ Object
-
#question_sheets ⇒ Object
Can’t rely on answer_sheet’s implementation for old reference’s that might have id’s that may match an application id.
- #reference ⇒ Object
- #reference? ⇒ Boolean
- #required? ⇒ Boolean
-
#send_invite ⇒ Object
send email invite.
- #to_s ⇒ Object
Methods included from AccessKeyGenerator
Methods included from AnswerSheetConcern
#answers_by_question, #collat_title, #complete?, #completely_filled_out?, #has_answer_for?, #languages, #pages, #percent_complete
Instance Method Details
#display_type ⇒ Object
151 152 153 |
# File 'app/models/fe/reference_sheet.rb', line 151 def display_type question.label.split(/:| \(/).first end |
#email_sent? ⇒ Boolean
86 |
# File 'app/models/fe/reference_sheet.rb', line 86 def email_sent?() !self.email_sent_at.nil? end |
#frozen? ⇒ Boolean
82 83 84 |
# File 'app/models/fe/reference_sheet.rb', line 82 def frozen? !%w(started created).include?(self.status) end |
#name ⇒ Object
117 118 119 |
# File 'app/models/fe/reference_sheet.rb', line 117 def name [first_name, last_name].join(' ') end |
#question_sheet ⇒ Object
Can’t rely on answer_sheet’s implementation for old reference’s that might have id’s that may match an application id
138 139 140 |
# File 'app/models/fe/reference_sheet.rb', line 138 def question_sheet QuestionSheet.find(question.) if question && question. end |
#question_sheet_ids ⇒ Object
147 148 149 |
# File 'app/models/fe/reference_sheet.rb', line 147 def question_sheet_ids [question_sheet.try(:id)].compact end |
#question_sheets ⇒ Object
Can’t rely on answer_sheet’s implementation for old reference’s that might have id’s that may match an application id
143 144 145 |
# File 'app/models/fe/reference_sheet.rb', line 143 def question_sheets [question_sheet] end |
#reference ⇒ Object
121 122 123 |
# File 'app/models/fe/reference_sheet.rb', line 121 def reference self end |
#reference? ⇒ Boolean
133 134 135 |
# File 'app/models/fe/reference_sheet.rb', line 133 def reference? true end |
#required? ⇒ Boolean
129 130 131 |
# File 'app/models/fe/reference_sheet.rb', line 129 def required? question.required?(applicant_answer_sheet) end |
#send_invite ⇒ Object
send email invite
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'app/models/fe/reference_sheet.rb', line 89 def send_invite return if self.email.blank? application = self.applicant_answer_sheet Notifier.notification(self.email, Fe.from_email, "Reference Invite", {'reference_full_name' => self.name, 'applicant_full_name' => application.applicant.name, 'applicant_email' => application.applicant.email, 'applicant_home_phone' => application.applicant.phone, 'reference_url' => edit_fe_reference_sheet_url(self, :a => self.access_key, :host => ActionMailer::Base.[:host])}).deliver # Send notification to applicant Notifier.notification(applicant_answer_sheet.applicant.email, # RECIPIENTS Fe.from_email, # FROM "Reference Notification to Applicant", # LIQUID TEMPLATE NAME {'applicant_full_name' => applicant_answer_sheet.applicant.name, 'reference_full_name' => self.name, 'reference_email' => self.email, 'application_url' => edit_fe_answer_sheet_url(applicant_answer_sheet, :host => ActionMailer::Base.[:host])}).deliver self.email_sent_at = Time.now self.save(:validate => false) true end |
#to_s ⇒ Object
125 126 127 |
# File 'app/models/fe/reference_sheet.rb', line 125 def to_s name end |