Class: Questionnaire
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Questionnaire
- Includes:
- ActiveModel::Dirty, DeletableAttachment
- Defined in:
- app/models/questionnaire.rb
Constant Summary collapse
- DIETARY_SPECIAL_NEEDS_MAX_LENGTH =
500- 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
- POSSIBLE_GRAD_YEARS =
(Date.today.year - 3...Date.today.year + 7).to_a.freeze
- POSSIBLE_RACE_ETHNICITIES =
[ "American Indian or Alaskan Native", "Asian / Pacific Islander", "Black or African American", "Hispanic", "White / Caucasian", "Multiple ethnicities / Other", "Prefer not to answer" ].freeze
- POSSIBLE_GENDERS =
From My MLH’s dropdown list. Should not validate against this list in case My MLH changes their options, as this would cause errors until a manual gem update
[ "Female", "Male", "Non-Binary", "I prefer not to say", "Other" ].freeze
- POSSIBLE_LEVELS_OF_STUDY =
From My MLH’s dropdown list. Should not validate against this list in case My MLH changes their options, as this would cause errors until a manual gem update
[ "Elementary / Middle School / Primary School", "High School / Secondary School", "University (Undergraduate)", "University (Master's / Doctoral)", "Vocational / Code School", "Not Currently a Student", "Other" ].freeze
Instance Method Summary collapse
- #acc_status_author ⇒ Object
- #age_at_time_of_event ⇒ Object
- #boarded_bus? ⇒ Boolean
- #can_rsvp? ⇒ Boolean
- #checked_in? ⇒ Boolean
- #checked_in_by ⇒ Object
- #date_of_birth_formatted ⇒ Object
- #did_rsvp? ⇒ Boolean
- #email ⇒ Object
- #fips_code ⇒ Object
- #full_location ⇒ Object
- #full_name ⇒ Object
- #message_events ⇒ Object
- #minor? ⇒ Boolean
- #portfolio_url=(value) ⇒ Object
- #school ⇒ Object
- #school_name ⇒ Object
- #vcs_url=(value) ⇒ Object
- #verbal_status ⇒ Object
Instance Method Details
#acc_status_author ⇒ Object
154 155 156 157 |
# File 'app/models/questionnaire.rb', line 154 def return unless .present? User.find() end |
#age_at_time_of_event ⇒ Object
176 177 178 |
# File 'app/models/questionnaire.rb', line 176 def age_at_time_of_event (Rails.configuration.hackathon['event_start_date'] - date_of_birth).to_i * 1.day end |
#boarded_bus? ⇒ Boolean
163 164 165 |
# File 'app/models/questionnaire.rb', line 163 def boarded_bus? boarded_bus_at.present? end |
#can_rsvp? ⇒ Boolean
184 185 186 |
# File 'app/models/questionnaire.rb', line 184 def can_rsvp? ["accepted", "rsvp_confirmed", "rsvp_denied"].include? acc_status end |
#checked_in? ⇒ Boolean
159 160 161 |
# File 'app/models/questionnaire.rb', line 159 def checked_in? checked_in_at.present? end |
#checked_in_by ⇒ Object
167 168 169 170 |
# File 'app/models/questionnaire.rb', line 167 def checked_in_by return unless checked_in_by_id.present? User.find(checked_in_by_id) end |
#date_of_birth_formatted ⇒ Object
150 151 152 |
# File 'app/models/questionnaire.rb', line 150 def date_of_birth_formatted date_of_birth.strftime("%B %-d, %Y") end |
#did_rsvp? ⇒ Boolean
188 189 190 |
# File 'app/models/questionnaire.rb', line 188 def did_rsvp? ['rsvp_confirmed', 'rsvp_denied'].include? acc_status end |
#email ⇒ Object
120 121 122 |
# File 'app/models/questionnaire.rb', line 120 def email user&.email end |
#fips_code ⇒ Object
172 173 174 |
# File 'app/models/questionnaire.rb', line 172 def fips_code Fips.where(city: school.city, state: school.state).first end |
#full_location ⇒ Object
146 147 148 |
# File 'app/models/questionnaire.rb', line 146 def full_location "#{school.city}, #{school.state}" end |
#full_name ⇒ Object
142 143 144 |
# File 'app/models/questionnaire.rb', line 142 def full_name "#{first_name} #{last_name}" end |
#message_events ⇒ Object
192 193 194 195 196 197 |
# File 'app/models/questionnaire.rb', line 192 def return [] unless ENV['SPARKPOST_API_KEY'] simple_spark = SimpleSpark::Client.new simple_spark..search(recipients: email) end |
#minor? ⇒ Boolean
180 181 182 |
# File 'app/models/questionnaire.rb', line 180 def minor? age_at_time_of_event < 18.years end |
#portfolio_url=(value) ⇒ Object
124 125 126 127 |
# File 'app/models/questionnaire.rb', line 124 def portfolio_url=(value) value = "http://" + value if !value.blank? && !value.include?("http://") && !value.include?("https://") super value end |
#school ⇒ Object
134 135 136 |
# File 'app/models/questionnaire.rb', line 134 def school School.find(school_id) if school_id end |
#school_name ⇒ Object
138 139 140 |
# File 'app/models/questionnaire.rb', line 138 def school_name school.name if school_id end |
#vcs_url=(value) ⇒ Object
129 130 131 132 |
# File 'app/models/questionnaire.rb', line 129 def vcs_url=(value) value = "http://" + value if !value.blank? && !value.include?("http://") && !value.include?("https://") super value end |
#verbal_status ⇒ Object
199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'app/models/questionnaire.rb', line 199 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 |