refactor: simplify city weather generation logic
- Introduced constants for configuration settings such as generation interval, maximum duration, and sleep duration. - Updated the `perform` method to utilize these constants for better readability and maintainability. - Refactored the `perform` method in `GenerateWeatherArtWorker` to improve flow and error handling by creating separate methods for fetching weather data, generating prompts, images, and handling database transactions. - Cleaned up city seeding data by removing unnecessary fields while maintaining required functionality. These changes improve the overall readability of the code and make it easier to adjust the behavior of the workers in the future without digging through the logic.
This commit is contained in:
parent
06a861c639
commit
b05cf10017
@ -1,28 +1,35 @@
|
|||||||
class BatchGenerateWeatherArtsWorker
|
class BatchGenerateWeatherArtsWorker
|
||||||
include Sidekiq::Worker
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
GENERATION_INTERVAL = 6.hours
|
||||||
|
MAX_DURATION = 50.minutes
|
||||||
|
SLEEP_DURATION = 3.seconds
|
||||||
|
|
||||||
def perform(*args)
|
def perform(*args)
|
||||||
start_time = Time.current
|
start_time = Time.current
|
||||||
max_duration = 50.minutes
|
|
||||||
|
|
||||||
cities_to_process = get_eligible_cities
|
cities_to_process = get_eligible_cities
|
||||||
|
|
||||||
cities_to_process.each do |city|
|
cities_to_process.each do |city|
|
||||||
break if Time.current - start_time > max_duration
|
break if Time.current - start_time > MAX_DURATION
|
||||||
|
|
||||||
# GenerateWeatherArtJob.perform_now(city)
|
|
||||||
GenerateWeatherArtWorker.perform_async(city.id)
|
GenerateWeatherArtWorker.perform_async(city.id)
|
||||||
sleep 3.seconds
|
sleep SLEEP_DURATION
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def get_eligible_cities
|
def get_eligible_cities
|
||||||
City.active
|
cutoff_time = Time.current - GENERATION_INTERVAL
|
||||||
.where(active: true)
|
|
||||||
.where("last_weather_fetch IS NULL OR last_weather_fetch < ?", Date.today)
|
|
||||||
# .select { |city| early_morning_in_timezone?(city.timezone) }
|
|
||||||
end
|
|
||||||
|
|
||||||
|
City.active
|
||||||
|
.joins("LEFT JOIN (
|
||||||
|
SELECT city_id, MAX(created_at) as last_generation_time
|
||||||
|
FROM weather_arts
|
||||||
|
GROUP BY city_id
|
||||||
|
) latest_arts ON cities.id = latest_arts.city_id")
|
||||||
|
.where("latest_arts.last_generation_time IS NULL OR latest_arts.last_generation_time < ?", cutoff_time)
|
||||||
|
.order(:priority)
|
||||||
|
end
|
||||||
end
|
end
|
@ -1,45 +1,66 @@
|
|||||||
class GenerateWeatherArtWorker
|
class GenerateWeatherArtWorker
|
||||||
include Sidekiq::Worker
|
include Sidekiq::Worker
|
||||||
|
|
||||||
def perform(*args)
|
def perform(city_id)
|
||||||
city_id = args[0]
|
@city = City.find(city_id)
|
||||||
return if city.last_weather_fetch&.today?
|
|
||||||
|
|
||||||
weather_service = WeatherService.new
|
weather_data = fetch_weather_data
|
||||||
ai_service = AiService.new
|
|
||||||
|
|
||||||
# 获取天气数据
|
|
||||||
weather_data = weather_service.get_weather(city.latitude, city.longitude)
|
|
||||||
return unless weather_data
|
return unless weather_data
|
||||||
|
|
||||||
# 生成提示词
|
prompt = generate_prompt(weather_data)
|
||||||
prompt = ai_service.generate_prompt(city, weather_data)
|
|
||||||
return unless prompt
|
return unless prompt
|
||||||
|
|
||||||
# 生成图像
|
image_url = generate_image(prompt)
|
||||||
image_url = ai_service.generate_image(prompt)
|
|
||||||
return unless image_url
|
return unless image_url
|
||||||
|
|
||||||
# 创建天气艺术记录
|
create_weather_art(weather_data, prompt, image_url)
|
||||||
|
rescue StandardError => e
|
||||||
|
Rails.logger.error "Error generating weather art for city #{city_id}: #{e.message}"
|
||||||
|
Rails.logger.error e.backtrace.join("\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
attr_reader :city
|
||||||
|
|
||||||
|
def fetch_weather_data
|
||||||
|
WeatherService.new.get_weather(city.latitude, city.longitude)
|
||||||
|
end
|
||||||
|
|
||||||
|
def generate_prompt(weather_data)
|
||||||
|
AiService.new.generate_prompt(city, weather_data)
|
||||||
|
end
|
||||||
|
|
||||||
|
def generate_image(prompt)
|
||||||
|
AiService.new.generate_image(prompt)
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_weather_art(weather_data, prompt, image_url)
|
||||||
|
ActiveRecord::Base.transaction do
|
||||||
weather_art = city.weather_arts.create!(
|
weather_art = city.weather_arts.create!(
|
||||||
weather_date: Date.today,
|
weather_date: Date.today,
|
||||||
**weather_data,
|
prompt: prompt,
|
||||||
prompt: prompt
|
**weather_data
|
||||||
)
|
)
|
||||||
|
|
||||||
# 下载并附加图像
|
attach_image(weather_art, image_url)
|
||||||
|
weather_art
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def attach_image(weather_art, image_url)
|
||||||
tempfile = Down.download(image_url)
|
tempfile = Down.download(image_url)
|
||||||
weather_art.image.attach(
|
weather_art.image.attach(
|
||||||
io: tempfile,
|
io: tempfile,
|
||||||
filename: "#{city.country.name}-#{city.name.parameterize}-#{Time.current.strftime('%Y%m%d-%H%M%S')}.png"
|
filename: generate_filename,
|
||||||
|
content_type: "image/png"
|
||||||
)
|
)
|
||||||
|
ensure
|
||||||
|
tempfile&.close
|
||||||
|
tempfile&.unlink
|
||||||
|
end
|
||||||
|
|
||||||
# 更新城市状态
|
def generate_filename
|
||||||
city.update!(
|
"#{city.country.name}-#{city.name.parameterize}-#{Time.current.strftime('%Y%m%d-%H%M%S')}.png"
|
||||||
last_weather_fetch: Time.current,
|
|
||||||
last_image_generation: Time.current
|
|
||||||
)
|
|
||||||
rescue => e
|
|
||||||
Rails.logger.error "Error generating weather art for #{city.name}: #{e.message}"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -8,9 +8,7 @@ City.create!([
|
|||||||
country: australia,
|
country: australia,
|
||||||
timezone: 'Australia/Sydney',
|
timezone: 'Australia/Sydney',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 80,
|
priority: 80
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Melbourne',
|
name: 'Melbourne',
|
||||||
@ -19,8 +17,6 @@ City.create!([
|
|||||||
country: australia,
|
country: australia,
|
||||||
timezone: 'Australia/Melbourne',
|
timezone: 'Australia/Melbourne',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 75,
|
priority: 75
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,8 +8,6 @@ City.create!([
|
|||||||
country: bangladesh,
|
country: bangladesh,
|
||||||
timezone: 'Asia/Dhaka',
|
timezone: 'Asia/Dhaka',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 85,
|
priority: 85
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,8 +8,6 @@ City.create!([
|
|||||||
country: brazil,
|
country: brazil,
|
||||||
timezone: 'America/Sao_Paulo',
|
timezone: 'America/Sao_Paulo',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 80,
|
priority: 80
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -6,7 +6,5 @@ City.create!(
|
|||||||
priority: 50,
|
priority: 50,
|
||||||
country: canada,
|
country: canada,
|
||||||
timezone: 'America/Toronto',
|
timezone: 'America/Toronto',
|
||||||
active: true,
|
active: true
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
)
|
)
|
||||||
|
@ -8,9 +8,7 @@ City.create!([
|
|||||||
country: china,
|
country: china,
|
||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Beijing',
|
name: 'Beijing',
|
||||||
@ -19,9 +17,7 @@ City.create!([
|
|||||||
country: china,
|
country: china,
|
||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Shenzhen',
|
name: 'Shenzhen',
|
||||||
@ -30,9 +26,7 @@ City.create!([
|
|||||||
country: china,
|
country: china,
|
||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Guangzhou',
|
name: 'Guangzhou',
|
||||||
@ -41,9 +35,7 @@ City.create!([
|
|||||||
country: china,
|
country: china,
|
||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Chengdu',
|
name: 'Chengdu',
|
||||||
@ -52,9 +44,7 @@ City.create!([
|
|||||||
country: china,
|
country: china,
|
||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Tianjin',
|
name: 'Tianjin',
|
||||||
@ -63,9 +53,7 @@ City.create!([
|
|||||||
country: china,
|
country: china,
|
||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Wuhan',
|
name: 'Wuhan',
|
||||||
@ -74,9 +62,7 @@ City.create!([
|
|||||||
country: china,
|
country: china,
|
||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Dongguan',
|
name: 'Dongguan',
|
||||||
@ -85,9 +71,7 @@ City.create!([
|
|||||||
country: china,
|
country: china,
|
||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Chongqing',
|
name: 'Chongqing',
|
||||||
@ -97,8 +81,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Xi'an",
|
name: "Xi'an",
|
||||||
@ -108,8 +90,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Hangzhou',
|
name: 'Hangzhou',
|
||||||
@ -119,8 +99,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Foshan',
|
name: 'Foshan',
|
||||||
@ -130,8 +108,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Nanjing',
|
name: 'Nanjing',
|
||||||
@ -141,8 +117,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Hong Kong',
|
name: 'Hong Kong',
|
||||||
@ -152,8 +126,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Hong_Kong',
|
timezone: 'Asia/Hong_Kong',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Shenyang',
|
name: 'Shenyang',
|
||||||
@ -163,8 +135,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Zhengzhou',
|
name: 'Zhengzhou',
|
||||||
@ -174,8 +144,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Qingdao',
|
name: 'Qingdao',
|
||||||
@ -185,8 +153,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Suzhou',
|
name: 'Suzhou',
|
||||||
@ -196,8 +162,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Changsha',
|
name: 'Changsha',
|
||||||
@ -207,8 +171,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Jinan',
|
name: 'Jinan',
|
||||||
@ -218,8 +180,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Kunming',
|
name: 'Kunming',
|
||||||
@ -229,8 +189,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Harbin',
|
name: 'Harbin',
|
||||||
@ -240,8 +198,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Shijiazhuang',
|
name: 'Shijiazhuang',
|
||||||
@ -251,8 +207,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Hefei',
|
name: 'Hefei',
|
||||||
@ -262,8 +216,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Dalian',
|
name: 'Dalian',
|
||||||
@ -273,8 +225,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Xiamen',
|
name: 'Xiamen',
|
||||||
@ -284,8 +234,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Nanning',
|
name: 'Nanning',
|
||||||
@ -295,8 +243,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Changchun',
|
name: 'Changchun',
|
||||||
@ -306,8 +252,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Taiyuan',
|
name: 'Taiyuan',
|
||||||
@ -317,8 +261,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'New Taipei City',
|
name: 'New Taipei City',
|
||||||
@ -328,8 +270,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Taipei',
|
timezone: 'Asia/Taipei',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Guiyang',
|
name: 'Guiyang',
|
||||||
@ -339,8 +279,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Wuxi',
|
name: 'Wuxi',
|
||||||
@ -350,8 +288,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Shantou',
|
name: 'Shantou',
|
||||||
@ -361,8 +297,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Ürümqi',
|
name: 'Ürümqi',
|
||||||
@ -372,8 +306,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Zhongshan',
|
name: 'Zhongshan',
|
||||||
@ -383,8 +315,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Ningbo',
|
name: 'Ningbo',
|
||||||
@ -394,8 +324,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Fuzhou',
|
name: 'Fuzhou',
|
||||||
@ -405,8 +333,6 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Nanchang',
|
name: 'Nanchang',
|
||||||
@ -416,7 +342,5 @@ City.create!([
|
|||||||
timezone: 'Asia/Shanghai',
|
timezone: 'Asia/Shanghai',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100,
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,8 +8,6 @@ City.create!([
|
|||||||
country: egypt,
|
country: egypt,
|
||||||
timezone: 'Africa/Cairo',
|
timezone: 'Africa/Cairo',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,8 +8,6 @@ City.create!([
|
|||||||
country: france,
|
country: france,
|
||||||
timezone: 'Europe/Paris',
|
timezone: 'Europe/Paris',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,9 +8,7 @@ City.create!([
|
|||||||
country: germany,
|
country: germany,
|
||||||
timezone: 'Europe/Berlin',
|
timezone: 'Europe/Berlin',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Berlin',
|
name: 'Berlin',
|
||||||
@ -19,8 +17,6 @@ City.create!([
|
|||||||
country: germany,
|
country: germany,
|
||||||
timezone: 'Europe/Berlin',
|
timezone: 'Europe/Berlin',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,9 +8,7 @@ City.create!([
|
|||||||
country: india,
|
country: india,
|
||||||
timezone: 'Asia/Kolkata',
|
timezone: 'Asia/Kolkata',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Bengaluru',
|
name: 'Bengaluru',
|
||||||
@ -19,8 +17,6 @@ City.create!([
|
|||||||
country: india,
|
country: india,
|
||||||
timezone: 'Asia/Kolkata',
|
timezone: 'Asia/Kolkata',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,9 +8,7 @@ City.create!([
|
|||||||
country: japan,
|
country: japan,
|
||||||
timezone: 'Asia/Tokyo',
|
timezone: 'Asia/Tokyo',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Yokohama',
|
name: 'Yokohama',
|
||||||
@ -19,8 +17,6 @@ City.create!([
|
|||||||
country: japan,
|
country: japan,
|
||||||
timezone: 'Asia/Tokyo',
|
timezone: 'Asia/Tokyo',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,8 +8,6 @@ City.create!([
|
|||||||
country: mexico,
|
country: mexico,
|
||||||
timezone: 'America/Mexico_City',
|
timezone: 'America/Mexico_City',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,8 +8,6 @@ City.create!([
|
|||||||
country: nigeria,
|
country: nigeria,
|
||||||
timezone: 'Africa/Lagos',
|
timezone: 'Africa/Lagos',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,8 +8,6 @@ City.create!([
|
|||||||
country: pakistan,
|
country: pakistan,
|
||||||
timezone: 'Asia/Karachi',
|
timezone: 'Asia/Karachi',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,9 +8,7 @@ City.create!([
|
|||||||
country: russia,
|
country: russia,
|
||||||
timezone: 'Europe/Moscow',
|
timezone: 'Europe/Moscow',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Sankt Petersburg',
|
name: 'Sankt Petersburg',
|
||||||
@ -19,8 +17,6 @@ City.create!([
|
|||||||
country: russia,
|
country: russia,
|
||||||
timezone: 'Europe/Moscow',
|
timezone: 'Europe/Moscow',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,8 +8,6 @@ City.create!([
|
|||||||
country: saudi_arabia,
|
country: saudi_arabia,
|
||||||
timezone: 'Asia/Riyadh',
|
timezone: 'Asia/Riyadh',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,8 +8,6 @@ City.create!([
|
|||||||
country: singapore,
|
country: singapore,
|
||||||
timezone: 'Asia/Singapore',
|
timezone: 'Asia/Singapore',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,8 +8,6 @@ City.create!([
|
|||||||
country: south_korea,
|
country: south_korea,
|
||||||
timezone: 'Asia/Seoul',
|
timezone: 'Asia/Seoul',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,8 +8,6 @@ City.create!([
|
|||||||
country: thailand,
|
country: thailand,
|
||||||
timezone: 'Asia/Bangkok',
|
timezone: 'Asia/Bangkok',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,9 +8,7 @@ City.create!([
|
|||||||
country: turkey,
|
country: turkey,
|
||||||
timezone: 'Europe/Istanbul',
|
timezone: 'Europe/Istanbul',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Ankara',
|
name: 'Ankara',
|
||||||
@ -19,8 +17,6 @@ City.create!([
|
|||||||
country: turkey,
|
country: turkey,
|
||||||
timezone: 'Europe/Istanbul',
|
timezone: 'Europe/Istanbul',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,8 +8,6 @@ City.create!([
|
|||||||
country: uk,
|
country: uk,
|
||||||
timezone: 'Europe/London',
|
timezone: 'Europe/London',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,9 +8,7 @@ City.create!([
|
|||||||
country: usa,
|
country: usa,
|
||||||
timezone: 'America/Los_Angeles',
|
timezone: 'America/Los_Angeles',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Chicago',
|
name: 'Chicago',
|
||||||
@ -19,9 +17,7 @@ City.create!([
|
|||||||
country: usa,
|
country: usa,
|
||||||
timezone: 'America/Chicago',
|
timezone: 'America/Chicago',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'New York City',
|
name: 'New York City',
|
||||||
@ -30,9 +26,7 @@ City.create!([
|
|||||||
country: usa,
|
country: usa,
|
||||||
timezone: 'America/New_York',
|
timezone: 'America/New_York',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Los Angeles',
|
name: 'Los Angeles',
|
||||||
@ -41,8 +35,6 @@ City.create!([
|
|||||||
country: usa,
|
country: usa,
|
||||||
timezone: 'America/Los_Angeles',
|
timezone: 'America/Los_Angeles',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -8,9 +8,7 @@ City.create!([
|
|||||||
country: vietnam,
|
country: vietnam,
|
||||||
timezone: 'Asia/Ho_Chi_Minh',
|
timezone: 'Asia/Ho_Chi_Minh',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Hanoi',
|
name: 'Hanoi',
|
||||||
@ -19,8 +17,6 @@ City.create!([
|
|||||||
country: vietnam,
|
country: vietnam,
|
||||||
timezone: 'Asia/Ho_Chi_Minh',
|
timezone: 'Asia/Ho_Chi_Minh',
|
||||||
active: true,
|
active: true,
|
||||||
priority: 100,
|
priority: 100
|
||||||
last_weather_fetch: 10.days.ago,
|
|
||||||
last_image_generation: 10.days.ago
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
Loading…
Reference in New Issue
Block a user