From 12d14a7e40cbacf91e076fff2c3fd6a605184c6b Mon Sep 17 00:00:00 2001 From: Jonathan Rosenbaum Date: Sun, 1 Feb 2026 03:03:54 +0000 Subject: [PATCH] Fixes #4 - check_in freezes site --- .../conference_administration_controller.rb | 57 ++++++++++--------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/app/controllers/conference_administration_controller.rb b/app/controllers/conference_administration_controller.rb index 8e4f14b..7ac93b1 100644 --- a/app/controllers/conference_administration_controller.rb +++ b/app/controllers/conference_administration_controller.rb @@ -310,33 +310,36 @@ class ConferenceAdministrationController < ApplicationController unregistered: 1 } - @registration_data = [] - User.all.each do |user| - if user.email.present? - new_data = { - user_id: user.id, - email: user.email, - name: user.firstname - } - - organization = user.organizations.first - new_data[:organization] = organization.present? ? organization.name : '' - - registration = @this_conference.registration_for(user) - if registration.present? && registration.city_id.present? - new_data[:location] = registration.city.to_s - status = registration.status - else - new_data[:location] = user.last_location.to_s - status = :unregistered - end - - new_data[:status] = I18n.t("articles.conference_registration.terms.registration_status.#{status}") - new_data[:sort_weight] = sort_weight[status] - - @registration_data << new_data - end - end + @registration_data = [] + + registrations = ConferenceRegistration.where(conference_id: @this_conference.id).includes(:user, :user => :organizations) + + registrations.each do |registration| + user = registration.user + next unless user&.email.present? + + new_data = { + user_id: user.id, + email: user.email, + name: user.firstname + } + + organization = user.organizations.first + new_data[:organization] = organization.present? ? organization.name : '' + + if registration.city_id.present? + new_data[:location] = registration.city.to_s + status = registration.status + else + new_data[:location] = user.last_location.to_s + status = :unregistered + end + + new_data[:status] = I18n.t("articles.conference_registration.terms.registration_status.#{status}") + new_data[:sort_weight] = sort_weight[status] + + @registration_data << new_data + end @registration_data.sort! { |a, b| b[:sort_weight] <=> a[:sort_weight] } end