songtianlun
b05cf10017
- 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.
14 lines
221 B
Ruby
14 lines
221 B
Ruby
bangladesh = Country.find_by code: 'BD'
|
|
|
|
City.create!([
|
|
{
|
|
name: 'Dhaka',
|
|
latitude: 23.8103,
|
|
longitude: 90.4125,
|
|
country: bangladesh,
|
|
timezone: 'Asia/Dhaka',
|
|
active: true,
|
|
priority: 85
|
|
}
|
|
])
|