Class: Manage::StatsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Manage::StatsController
- Defined in:
- app/controllers/manage/stats_controller.rb
Instance Method Summary collapse
- #alt_travel ⇒ Object
- #dietary_special_needs ⇒ Object
- #index ⇒ Object
- #mlh_info ⇒ Object
- #sponsor_info ⇒ Object
Methods inherited from ApplicationController
#limit_admin_access, #logged_in
Instance Method Details
#alt_travel ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'app/controllers/manage/stats_controller.rb', line 57 def alt_travel data = Rails.cache.fetch(cache_key_for_questionnaires("alt_travel")) do select_attributes = [ :id, :first_name, :last_name, :travel_location, :acc_status, :user_id, :school_id ] json_attributes = [ :id, :first_name, :last_name, :email, :travel_location, :acc_status ] data = Questionnaire.where("travel_not_from_school = '1'").select(select_attributes) json = to_json_array(data, json_attributes) json.each do |e| e[0] = view_context.link_to("View »".html_safe, manage_questionnaire_path(e[0])) end end render json: { data: data } end |
#dietary_special_needs ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/manage/stats_controller.rb', line 5 def dietary_special_needs data = Rails.cache.fetch(cache_key_for_questionnaires("dietary_special_needs")) do select_attributes = [ :first_name, :last_name, :phone, :checked_in_at, :dietary_restrictions, :special_needs, :user_id ] json_attributes = [ :first_name, :last_name, :email, :phone, :checked_in_at, :dietary_restrictions, :special_needs ] data = Questionnaire.where("dietary_restrictions != '' AND acc_status = 'rsvp_confirmed' OR special_needs != '' AND acc_status = 'rsvp_confirmed'").select(select_attributes) to_json_array(data, json_attributes) end render json: { data: data } end |
#index ⇒ Object
2 3 |
# File 'app/controllers/manage/stats_controller.rb', line 2 def index end |
#mlh_info ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'app/controllers/manage/stats_controller.rb', line 85 def mlh_info data = Rails.cache.fetch(cache_key_for_questionnaires("mlh_info")) do select_attributes = [ :first_name, :last_name, :phone, :user_id, :school_id ] json_attributes = [ :first_name, :last_name, :email, :phone, :school_name ] data = Questionnaire.joins(:school).select(select_attributes) to_json_array(data, json_attributes) end render json: { data: data } end |
#sponsor_info ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/manage/stats_controller.rb', line 31 def sponsor_info data = Rails.cache.fetch(cache_key_for_questionnaires("sponsor_info")) do select_attributes = [ :first_name, :last_name, :vcs_url, :portfolio_url, :user_id, :school_id, :resume_file_name ] json_attributes = [ :first_name, :last_name, :email, :school_name, :vcs_url, :portfolio_url ] data = Questionnaire.where("can_share_info = '1' AND checked_in_at != 0").select(select_attributes) json = to_json_array(data, json_attributes) json.map.with_index { |item, index| item.insert(5, data[index].resume? ? data[index].resume.url : '') } end render json: { data: data } end |