Class: Manage::StatsController
- Inherits:
-
ApplicationController
- Object
- 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
Instance Method Details
#alt_travel ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/manage/stats_controller.rb', line 35 def alt_travel data = Rails.cache.fetch(cache_key_for_questionnaires("alt_travel")) do attributes = [:id, :first_name, :last_name, :email, :travel_location, :acc_status] select_attributes = Array.new(attributes) << [:user_id, :school_id] data = Questionnaire.where("travel_not_from_school = '1'").select(select_attributes) json = to_json_array(data, 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 |
# 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 attributes = [:first_name, :last_name, :email, :phone, :checked_in_at, :dietary_restrictions, :special_needs] select_attributes = Array.new(attributes) << :user_id 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, 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
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'app/controllers/manage/stats_controller.rb', line 53 def mlh_info data = Rails.cache.fetch(cache_key_for_questionnaires("mlh_info")) do attributes = [:first_name, :last_name, :email, :phone] select_attributes = Array.new(attributes) << :user_id data = Questionnaire.select(select_attributes) to_json_array(data, attributes) end render json: { data: data } end |
#sponsor_info ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/manage/stats_controller.rb', line 21 def sponsor_info data = Rails.cache.fetch(cache_key_for_questionnaires("sponsor_info")) do attributes = [:first_name, :last_name, :email, :vcs_url, :portfolio_url] select_attributes = Array.new(attributes) << :user_id data = Questionnaire.where("can_share_info = '1' AND acc_status = 'rsvp_confirmed'").select(select_attributes) to_json_array(data, attributes) end render json: { data: data } end |