Class: Questionnaire
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Questionnaire
- Includes:
- ActiveModel::Dirty, DeletableAttachment
- Defined in:
- app/models/questionnaire.rb
Constant Summary collapse
- POSSIBLE_EXPERIENCES =
{ "first" => "This is my 1st hackathon!", "experienced" => "My feet are wet. (1-5 hackathons)", "expert" => "I'm a veteran hacker. (6+ hackathons)" }.freeze
- POSSIBLE_INTERESTS =
{ "design" => "Design", "software" => "Software", "hardware" => "Hardware", "combination" => "Combination of everything!" }.freeze
- POSSIBLE_SHIRT_SIZES =
[ "Women's - XS", "Women's - S", "Women's - M", "Women's - L", "Women's - XL", "Unisex - XS", "Unisex - S", "Unisex - M", "Unisex - L", "Unisex - XL" ].freeze
- POSSIBLE_ACC_STATUS =
{ "pending" => "Pending Review", "accepted" => "Accepted", "waitlist" => "Waitlisted", "denied" => "Denied", "late_waitlist" => "Waitlisted, Late", "rsvp_confirmed" => "RSVP Confirmed", "rsvp_denied" => "RSVP Denied" }.freeze
Instance Method Summary collapse
- #acc_status_author ⇒ Object
- #bus_list ⇒ Object
- #can_rsvp? ⇒ Boolean
- #checked_in? ⇒ Boolean
- #checked_in_by ⇒ Object
- #date_of_birth_formatted ⇒ Object
- #did_rsvp? ⇒ Boolean
- #eligible_for_a_bus? ⇒ Boolean
- #email ⇒ Object
- #fips_code ⇒ Object
- #full_location ⇒ Object
- #full_name ⇒ Object
- #invite_to_slack ⇒ Object
- #message_events ⇒ Object
- #portfolio_url=(value) ⇒ Object
- #school ⇒ Object
- #vcs_url=(value) ⇒ Object
- #verbal_status ⇒ Object
Instance Method Details
#acc_status_author ⇒ Object
102 103 104 105 |
# File 'app/models/questionnaire.rb', line 102 def return unless .present? User.find() end |
#bus_list ⇒ Object
132 133 134 135 |
# File 'app/models/questionnaire.rb', line 132 def bus_list return unless eligible_for_a_bus? school.bus_list end |
#can_rsvp? ⇒ Boolean
120 121 122 |
# File 'app/models/questionnaire.rb', line 120 def can_rsvp? ["accepted", "rsvp_confirmed", "rsvp_denied"].include? acc_status end |
#checked_in? ⇒ Boolean
107 108 109 |
# File 'app/models/questionnaire.rb', line 107 def checked_in? checked_in_at.present? end |
#checked_in_by ⇒ Object
111 112 113 114 |
# File 'app/models/questionnaire.rb', line 111 def checked_in_by return unless checked_in_by_id.present? User.find(checked_in_by_id) end |
#date_of_birth_formatted ⇒ Object
98 99 100 |
# File 'app/models/questionnaire.rb', line 98 def date_of_birth_formatted date_of_birth.strftime("%B %-d, %Y") end |
#did_rsvp? ⇒ Boolean
124 125 126 |
# File 'app/models/questionnaire.rb', line 124 def did_rsvp? ['rsvp_confirmed', 'rsvp_denied'].include? acc_status end |
#eligible_for_a_bus? ⇒ Boolean
128 129 130 |
# File 'app/models/questionnaire.rb', line 128 def eligible_for_a_bus? school.present? && school.bus_list_id? end |
#email ⇒ Object
72 73 74 |
# File 'app/models/questionnaire.rb', line 72 def email user.email end |
#fips_code ⇒ Object
116 117 118 |
# File 'app/models/questionnaire.rb', line 116 def fips_code Fips.where(city: school.city, state: school.state).first end |
#full_location ⇒ Object
94 95 96 |
# File 'app/models/questionnaire.rb', line 94 def full_location "#{school.city}, #{school.state}" end |
#full_name ⇒ Object
90 91 92 |
# File 'app/models/questionnaire.rb', line 90 def full_name "#{first_name} #{last_name}" end |
#invite_to_slack ⇒ Object
144 145 146 |
# File 'app/models/questionnaire.rb', line 144 def invite_to_slack SlackInviteWorker.perform_async(id) end |
#message_events ⇒ Object
137 138 139 140 141 142 |
# File 'app/models/questionnaire.rb', line 137 def return [] unless ENV['SPARKPOST_API_KEY'] simple_spark = SimpleSpark::Client.new simple_spark..search(recipients: email) end |
#portfolio_url=(value) ⇒ Object
76 77 78 79 |
# File 'app/models/questionnaire.rb', line 76 def portfolio_url=(value) value = "http://" + value if !value.blank? && !value.include?("http://") && !value.include?("https://") super value end |
#school ⇒ Object
86 87 88 |
# File 'app/models/questionnaire.rb', line 86 def school School.find(school_id) if school_id end |
#vcs_url=(value) ⇒ Object
81 82 83 84 |
# File 'app/models/questionnaire.rb', line 81 def vcs_url=(value) value = "http://" + value if !value.blank? && !value.include?("http://") && !value.include?("https://") super value end |
#verbal_status ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'app/models/questionnaire.rb', line 148 def verbal_status if acc_status == "rsvp_denied" "Not Attending" elsif acc_status == "rsvp_confirmed" "Accepted & Attending" elsif acc_status == "accepted" "Accepted, Awaiting RSVP" elsif ["pending", "waitlist", "late_waitlist"].include? acc_status "Pending Review" elsif acc_status == "denied" "Denied" end end |