From 742c94ced1ce40e28a30d8bfb471de3458f8b2c1 Mon Sep 17 00:00:00 2001 From: songtianlun Date: Sat, 25 Jan 2025 10:51:14 +0800 Subject: [PATCH] style: update layout of city show view - Change stats div to be responsive - Adjust coordinates display format for better readability This update enhances the layout of the city show view by making it more responsive and improving the display of weather and geographical data. Additionally, the startup task for refreshing the sitemap is now consistently executed, removing unnecessary complexity. --- app/views/cities/show.html.erb | 6 ++++-- config/initializers/schedule_tasks.rb | 19 +------------------ 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/app/views/cities/show.html.erb b/app/views/cities/show.html.erb index f4d5437..60459b5 100644 --- a/app/views/cities/show.html.erb +++ b/app/views/cities/show.html.erb @@ -27,7 +27,7 @@ -
+
Latest Weather
@@ -40,7 +40,7 @@
Coordinates
- <%= @city.latitude %>°N, <%= @city.longitude %>°E + <%= @city.latitude %>°N,
<%= @city.longitude %>°E
Geographical Location
@@ -50,6 +50,8 @@
Total Entries
+ +
diff --git a/config/initializers/schedule_tasks.rb b/config/initializers/schedule_tasks.rb index a730118..6340fdc 100644 --- a/config/initializers/schedule_tasks.rb +++ b/config/initializers/schedule_tasks.rb @@ -1,21 +1,4 @@ # config/initializers/schedule_tasks.rb Rails.application.config.after_initialize do - if Rails.env.production? && !ENV["RAILS_BUILD"] - begin - redis_key = "startup_task_running" - unless Sidekiq.redis { |conn| conn.get(redis_key) } - Sidekiq.redis do |conn| - conn.setex(redis_key, 1.hour.to_i, "1") - end - - RefreshSitemapWorker.perform_async - - Rails.logger.info "Startup task (RefreshSitemapWorker) scheduled successfully" - end - rescue => e - Rails.logger.error "Error scheduling startup task: #{e.message}" - ensure - Sidekiq.redis { |conn| conn.del(redis_key) } - end - end + RefreshSitemapWorker.perform_async end