diff --git a/app/controllers/api/v0/competitions_controller.rb b/app/controllers/api/v0/competitions_controller.rb
index d16540777a..4fa21ad8da 100644
--- a/app/controllers/api/v0/competitions_controller.rb
+++ b/app/controllers/api/v0/competitions_controller.rb
@@ -25,7 +25,7 @@ def competition_index
competitions = competitions_scope.search(params[:q], params: params)
- serial_methods = ["short_display_name", "city", "country_iso2", "event_ids", "date_range", "latitude_degrees", "longitude_degrees", "registration_status"]
+ serial_methods = ["short_display_name", "city", "country_iso2", "event_ids", "date_range", "latitude_degrees", "longitude_degrees", "cached_registration_status"]
serial_includes = {}
serial_includes["delegates"] = { only: ["id", "name"], methods: [], include: ["avatar"] } if admin_mode
diff --git a/app/models/competition.rb b/app/models/competition.rb
index 358ad74b69..1e95a247ea 100644
--- a/app/models/competition.rb
+++ b/app/models/competition.rb
@@ -1008,6 +1008,12 @@ def registration_status
end
end
+ def cached_registration_status
+ Rails.cache.fetch(["comp-registration-status", self.id], expires_in: 5.minutes) do
+ self.registration_status
+ end
+ end
+
def any_registrations?
self.registrations.any?
end
diff --git a/app/webpacker/components/CompetitionsOverview/ListViewSection.js b/app/webpacker/components/CompetitionsOverview/ListViewSection.js
index 3f76a5d9b6..b375bf6090 100644
--- a/app/webpacker/components/CompetitionsOverview/ListViewSection.js
+++ b/app/webpacker/components/CompetitionsOverview/ListViewSection.js
@@ -408,7 +408,7 @@ function ConditionalYearHeader({
}
function RegistrationStatus({ comp }) {
- if (comp.registration_status === 'not_yet_opened') {
+ if (comp.cached_registration_status === 'not_yet_opened') {
return (
}
@@ -418,7 +418,7 @@ function RegistrationStatus({ comp }) {
/>
);
}
- if (comp.registration_status === 'past') {
+ if (comp.cached_registration_status === 'past') {
return (
}
@@ -428,7 +428,7 @@ function RegistrationStatus({ comp }) {
/>
);
}
- if (comp.registration_status === 'full') {
+ if (comp.cached_registration_status === 'full') {
return (
}
@@ -438,7 +438,7 @@ function RegistrationStatus({ comp }) {
/>
);
}
- if (comp.registration_status === 'open') {
+ if (comp.cached_registration_status === 'open') {
return (
}