feat: refactor code organization and query complexity
- Simplify query for most popular inactive cities in City model - Minor layout changes in Admin Dashboards for Ahoy and Sidekiq tasks This refactoring improves code organization, reducing complexity in the City model and making it easier to read. Additionally, the Admin dashboard layouts have been simplified for a better user experience.
This commit is contained in:
parent
069b6d4a4f
commit
f0f94de528
@ -61,6 +61,5 @@ ActiveAdmin.register_page "Ahoy Dashboard" do
|
|||||||
column :properties
|
column :properties
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -75,8 +75,6 @@ ActiveAdmin.register_page "Sidekiq Tasks" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class City < ApplicationRecord
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
scope :most_popular_inactive, -> {
|
scope :most_popular_inactive, -> {
|
||||||
if ActiveRecord::Base.connection.adapter_name.downcase == 'sqlite'
|
if ActiveRecord::Base.connection.adapter_name.downcase == "sqlite"
|
||||||
where(active: false)
|
where(active: false)
|
||||||
.joins("LEFT JOIN ahoy_events ON json_extract(ahoy_events.properties, '$.city_id') = cities.id
|
.joins("LEFT JOIN ahoy_events ON json_extract(ahoy_events.properties, '$.city_id') = cities.id
|
||||||
AND json_extract(ahoy_events.properties, '$.event_type') = 'city_view'")
|
AND json_extract(ahoy_events.properties, '$.event_type') = 'city_view'")
|
||||||
|
Loading…
Reference in New Issue
Block a user