diff --git a/app/controllers/api/v1/registrations/registrations_controller.rb b/app/controllers/api/v1/registrations/registrations_controller.rb index e5c5358f94..bfe8d6eea2 100644 --- a/app/controllers/api/v1/registrations/registrations_controller.rb +++ b/app/controllers/api/v1/registrations/registrations_controller.rb @@ -89,8 +89,17 @@ def validate_bulk_update_request def list competition_id = list_params - registrations = Registration.accepted.where(competition_id: competition_id) - render json: registrations.includes(:user).map { |r| r.to_v2_json } + competition = Competition.find(competition_id) + registrations = competition.registrations.accepted + payload = Rails.cache.fetch([ + "registrations_v2_list", + competition.id, + competition.event_ids, + registrations.joins(:user).order(:id).pluck(:id, :updated_at, user: [:updated_at]), + ]) do + registrations.includes(:user).map { |r| r.to_v2_json } + end + render json: payload end # To list Registrations in the admin view you need to be able to administer the competition diff --git a/app/views/registrations/index.html.erb b/app/views/registrations/index.html.erb index 52466d7b2b..055bb0fc9b 100644 --- a/app/views/registrations/index.html.erb +++ b/app/views/registrations/index.html.erb @@ -1,12 +1,5 @@ <% provide(:title, I18n.t('registrations.list.title', comp: @competition.name)) %> <%= render layout: "nav" do %> - <% cache [ - "registrations_index", - @competition.events.pluck(:id), - @competition.registrations.accepted.joins(:user).order(:id).pluck(:id, :updated_at, :"users.updated_at"), - I18n.locale - ] do %> - <%= react_component('RegistrationsV2/Registrations', { competitionInfo: @competition.to_competition_info }) %> - <% end %> + <%= react_component('RegistrationsV2/Registrations', { competitionInfo: @competition.to_competition_info }) %> <% end %>