From ba8957e444705dc85b340bb5d33d3b2863189c12 Mon Sep 17 00:00:00 2001 From: songtianlun Date: Wed, 5 Feb 2025 14:57:08 +0800 Subject: [PATCH] refactor: simplify city table queries - Removed the limit on City queries in the Ahoy Dashboard - Updated table_for calls for least popular active and most popular inactive cities to fetch all records instead of limiting to 10 This change allows the dashboard to display all relevant cities without artificial limits, providing a more comprehensive overview of city activity. The previous limitations may have hidden important data for analysis and reporting purposes. --- app/admin/ahoy_dashboard.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/admin/ahoy_dashboard.rb b/app/admin/ahoy_dashboard.rb index b82a521..09f7492 100644 --- a/app/admin/ahoy_dashboard.rb +++ b/app/admin/ahoy_dashboard.rb @@ -38,7 +38,8 @@ ActiveAdmin.register_page "Ahoy Dashboard" do columns do column do panel "最冷门活跃城市" do - table_for City.least_popular_active.limit(10) do + # table_for City.least_popular_active.limit(10) do + table_for City.least_popular_active do column("城市") { |city| link_to(city.name, admin_city_path(city)) } column("访问量") { |city| city.view_count } column("状态") { |city| status_tag(city.active? ? "活跃" : "停用") } @@ -55,7 +56,8 @@ ActiveAdmin.register_page "Ahoy Dashboard" do column do panel "热门未活跃城市" do - table_for City.most_popular_inactive.limit(10) do + # table_for City.most_popular_inactive.limit(10) do + table_for City.most_popular_inactive do column("城市") { |city| link_to(city.name, admin_city_path(city)) } column("访问量") { |city| city.view_count } column("状态") { |city| status_tag(city.active? ? "活跃" : "停用") }