8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'app/workers/hh_package/reload_service_type_city_worker.rb', line 8
def perform(service_type)
package_types = ServiceType::PACKAGE_TYPES[service_type.to_sym].map do |short_type|
package_type = HhPackage::PACKAGE_LIST_TO_SHORT.invert[short_type.to_s]
"HhPackage::Package::#{package_type}"
end
collections = Restaurant.joins(:restaurant_packages)
.where(hh_package_restaurant_packages: { package_type: package_types })
.group('restaurants.city_id')
city_ids = collections.pluck(:city_id)
reload_data_service_type(city_ids.flatten.uniq, service_type)
end
|