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
|
||||
include Sidekiq::Worker
|
||||
|
||||
GENERATION_INTERVAL = 6.hours
|
||||
MAX_DURATION = 50.minutes
|
||||
SLEEP_DURATION = 3.seconds
|
||||
|
||||
def perform(*args)
|
||||
start_time = Time.current
|
||||
max_duration = 50.minutes
|
||||
|
||||
cities_to_process = get_eligible_cities
|
||||
|
||||
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)
|
||||
sleep 3.seconds
|
||||
sleep SLEEP_DURATION
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def get_eligible_cities
|
||||
City.active
|
||||
.where(active: true)
|
||||
.where("last_weather_fetch IS NULL OR last_weather_fetch < ?", Date.today)
|
||||
# .select { |city| early_morning_in_timezone?(city.timezone) }
|
||||
end
|
||||
cutoff_time = Time.current - GENERATION_INTERVAL
|
||||
|
||||
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
|
@ -1,45 +1,66 @@
|
||||
class GenerateWeatherArtWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
def perform(*args)
|
||||
city_id = args[0]
|
||||
return if city.last_weather_fetch&.today?
|
||||
def perform(city_id)
|
||||
@city = City.find(city_id)
|
||||
|
||||
weather_service = WeatherService.new
|
||||
ai_service = AiService.new
|
||||
|
||||
# 获取天气数据
|
||||
weather_data = weather_service.get_weather(city.latitude, city.longitude)
|
||||
weather_data = fetch_weather_data
|
||||
return unless weather_data
|
||||
|
||||
# 生成提示词
|
||||
prompt = ai_service.generate_prompt(city, weather_data)
|
||||
prompt = generate_prompt(weather_data)
|
||||
return unless prompt
|
||||
|
||||
# 生成图像
|
||||
image_url = ai_service.generate_image(prompt)
|
||||
image_url = generate_image(prompt)
|
||||
return unless image_url
|
||||
|
||||
# 创建天气艺术记录
|
||||
weather_art = city.weather_arts.create!(
|
||||
weather_date: Date.today,
|
||||
**weather_data,
|
||||
prompt: prompt
|
||||
)
|
||||
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_date: Date.today,
|
||||
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)
|
||||
weather_art.image.attach(
|
||||
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"
|
||||
)
|
||||
|
||||
# 更新城市状态
|
||||
city.update!(
|
||||
last_weather_fetch: Time.current,
|
||||
last_image_generation: Time.current
|
||||
)
|
||||
rescue => e
|
||||
Rails.logger.error "Error generating weather art for #{city.name}: #{e.message}"
|
||||
ensure
|
||||
tempfile&.close
|
||||
tempfile&.unlink
|
||||
end
|
||||
end
|
||||
|
||||
def generate_filename
|
||||
"#{city.country.name}-#{city.name.parameterize}-#{Time.current.strftime('%Y%m%d-%H%M%S')}.png"
|
||||
end
|
||||
end
|
@ -8,9 +8,7 @@ City.create!([
|
||||
country: australia,
|
||||
timezone: 'Australia/Sydney',
|
||||
active: true,
|
||||
priority: 80,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 80
|
||||
},
|
||||
{
|
||||
name: 'Melbourne',
|
||||
@ -19,8 +17,6 @@ City.create!([
|
||||
country: australia,
|
||||
timezone: 'Australia/Melbourne',
|
||||
active: true,
|
||||
priority: 75,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 75
|
||||
}
|
||||
])
|
||||
|
@ -8,8 +8,6 @@ City.create!([
|
||||
country: bangladesh,
|
||||
timezone: 'Asia/Dhaka',
|
||||
active: true,
|
||||
priority: 85,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 85
|
||||
}
|
||||
])
|
||||
|
@ -8,8 +8,6 @@ City.create!([
|
||||
country: brazil,
|
||||
timezone: 'America/Sao_Paulo',
|
||||
active: true,
|
||||
priority: 80,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 80
|
||||
}
|
||||
])
|
||||
|
@ -6,7 +6,5 @@ City.create!(
|
||||
priority: 50,
|
||||
country: canada,
|
||||
timezone: 'America/Toronto',
|
||||
active: true,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
active: true
|
||||
)
|
||||
|
@ -8,9 +8,7 @@ City.create!([
|
||||
country: china,
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Beijing',
|
||||
@ -19,9 +17,7 @@ City.create!([
|
||||
country: china,
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Shenzhen',
|
||||
@ -30,9 +26,7 @@ City.create!([
|
||||
country: china,
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Guangzhou',
|
||||
@ -41,9 +35,7 @@ City.create!([
|
||||
country: china,
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Chengdu',
|
||||
@ -52,9 +44,7 @@ City.create!([
|
||||
country: china,
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Tianjin',
|
||||
@ -63,9 +53,7 @@ City.create!([
|
||||
country: china,
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Wuhan',
|
||||
@ -74,9 +62,7 @@ City.create!([
|
||||
country: china,
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Dongguan',
|
||||
@ -85,9 +71,7 @@ City.create!([
|
||||
country: china,
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Chongqing',
|
||||
@ -97,8 +81,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: "Xi'an",
|
||||
@ -108,8 +90,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Hangzhou',
|
||||
@ -119,8 +99,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Foshan',
|
||||
@ -130,8 +108,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Nanjing',
|
||||
@ -141,8 +117,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Hong Kong',
|
||||
@ -152,8 +126,6 @@ City.create!([
|
||||
timezone: 'Asia/Hong_Kong',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Shenyang',
|
||||
@ -163,8 +135,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Zhengzhou',
|
||||
@ -174,8 +144,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Qingdao',
|
||||
@ -185,8 +153,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Suzhou',
|
||||
@ -196,8 +162,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Changsha',
|
||||
@ -207,8 +171,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Jinan',
|
||||
@ -218,8 +180,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Kunming',
|
||||
@ -229,8 +189,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Harbin',
|
||||
@ -240,8 +198,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Shijiazhuang',
|
||||
@ -251,8 +207,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Hefei',
|
||||
@ -262,8 +216,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Dalian',
|
||||
@ -273,8 +225,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Xiamen',
|
||||
@ -284,8 +234,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Nanning',
|
||||
@ -295,8 +243,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Changchun',
|
||||
@ -306,8 +252,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Taiyuan',
|
||||
@ -317,8 +261,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'New Taipei City',
|
||||
@ -328,8 +270,6 @@ City.create!([
|
||||
timezone: 'Asia/Taipei',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Guiyang',
|
||||
@ -339,8 +279,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Wuxi',
|
||||
@ -350,8 +288,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Shantou',
|
||||
@ -361,8 +297,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Ürümqi',
|
||||
@ -372,8 +306,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Zhongshan',
|
||||
@ -383,8 +315,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Ningbo',
|
||||
@ -394,8 +324,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Fuzhou',
|
||||
@ -405,8 +333,6 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
},
|
||||
{
|
||||
name: 'Nanchang',
|
||||
@ -416,7 +342,5 @@ City.create!([
|
||||
timezone: 'Asia/Shanghai',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
}
|
||||
])
|
||||
|
@ -8,8 +8,6 @@ City.create!([
|
||||
country: egypt,
|
||||
timezone: 'Africa/Cairo',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,8 +8,6 @@ City.create!([
|
||||
country: france,
|
||||
timezone: 'Europe/Paris',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,9 +8,7 @@ City.create!([
|
||||
country: germany,
|
||||
timezone: 'Europe/Berlin',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Berlin',
|
||||
@ -19,8 +17,6 @@ City.create!([
|
||||
country: germany,
|
||||
timezone: 'Europe/Berlin',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,9 +8,7 @@ City.create!([
|
||||
country: india,
|
||||
timezone: 'Asia/Kolkata',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Bengaluru',
|
||||
@ -19,8 +17,6 @@ City.create!([
|
||||
country: india,
|
||||
timezone: 'Asia/Kolkata',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,9 +8,7 @@ City.create!([
|
||||
country: japan,
|
||||
timezone: 'Asia/Tokyo',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Yokohama',
|
||||
@ -19,8 +17,6 @@ City.create!([
|
||||
country: japan,
|
||||
timezone: 'Asia/Tokyo',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,8 +8,6 @@ City.create!([
|
||||
country: mexico,
|
||||
timezone: 'America/Mexico_City',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,8 +8,6 @@ City.create!([
|
||||
country: nigeria,
|
||||
timezone: 'Africa/Lagos',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,8 +8,6 @@ City.create!([
|
||||
country: pakistan,
|
||||
timezone: 'Asia/Karachi',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,9 +8,7 @@ City.create!([
|
||||
country: russia,
|
||||
timezone: 'Europe/Moscow',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Sankt Petersburg',
|
||||
@ -19,8 +17,6 @@ City.create!([
|
||||
country: russia,
|
||||
timezone: 'Europe/Moscow',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,8 +8,6 @@ City.create!([
|
||||
country: saudi_arabia,
|
||||
timezone: 'Asia/Riyadh',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,8 +8,6 @@ City.create!([
|
||||
country: singapore,
|
||||
timezone: 'Asia/Singapore',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,8 +8,6 @@ City.create!([
|
||||
country: south_korea,
|
||||
timezone: 'Asia/Seoul',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,8 +8,6 @@ City.create!([
|
||||
country: thailand,
|
||||
timezone: 'Asia/Bangkok',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,9 +8,7 @@ City.create!([
|
||||
country: turkey,
|
||||
timezone: 'Europe/Istanbul',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Ankara',
|
||||
@ -19,8 +17,6 @@ City.create!([
|
||||
country: turkey,
|
||||
timezone: 'Europe/Istanbul',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,8 +8,6 @@ City.create!([
|
||||
country: uk,
|
||||
timezone: 'Europe/London',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,9 +8,7 @@ City.create!([
|
||||
country: usa,
|
||||
timezone: 'America/Los_Angeles',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Chicago',
|
||||
@ -19,9 +17,7 @@ City.create!([
|
||||
country: usa,
|
||||
timezone: 'America/Chicago',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'New York City',
|
||||
@ -30,9 +26,7 @@ City.create!([
|
||||
country: usa,
|
||||
timezone: 'America/New_York',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Los Angeles',
|
||||
@ -41,8 +35,6 @@ City.create!([
|
||||
country: usa,
|
||||
timezone: 'America/Los_Angeles',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
@ -8,9 +8,7 @@ City.create!([
|
||||
country: vietnam,
|
||||
timezone: 'Asia/Ho_Chi_Minh',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
},
|
||||
{
|
||||
name: 'Hanoi',
|
||||
@ -19,8 +17,6 @@ City.create!([
|
||||
country: vietnam,
|
||||
timezone: 'Asia/Ho_Chi_Minh',
|
||||
active: true,
|
||||
priority: 100,
|
||||
last_weather_fetch: 10.days.ago,
|
||||
last_image_generation: 10.days.ago
|
||||
priority: 100
|
||||
}
|
||||
])
|
||||
|
Loading…
Reference in New Issue
Block a user