- Added a space in the array passed to `add_index` in the migration
- Removed unused columns `last_weather_fetch` and `last_image_generation` from the `cities` table
- Ensured consistent code style in the `GenerateWeatherArtWorker` and added required newline at the end of files
These changes improve code readability and maintainability while ensuring that
no unnecessary fields exist in the database schema.
- 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.
- Implement caching methods for last weather fetch and image generation
- Adjust sleep duration in BatchGenerateWeatherArtsWorker from 10 seconds to 3 seconds
- Remove unused fields `last_weather_fetch` and `last_image_generation` from the cities table
- Add index on the weather_arts table for optimized querying
This refactor improves data retrieval performance for weather data
associated with cities. Caching reduces database load while the
worker modification allows for faster iterations in generating
weather arts without significantly impacting performance.
- Changed 'last_weather_fetch' and 'last_image_generation'
from 10.hours.ago to 10.days.ago for various cities
- Affects seed data for cities in multiple countries, including:
- Australia
- Bangladesh
- Brazil
- Canada
- China
- Egypt
- France
- Germany
- India
- Japan
- Mexico
- Nigeria
- Pakistan
- Russia
- Saudi Arabia
- Singapore
- South Korea
- Thailand
- Turkey
- UK
- USA
- Vietnam
This change ensures that the timestamps reflect a more refined time range for when last weather data was fetched, possibly to enhance performance or consistency in application behavior.
- Remove environment condition for admin user creation
This change simplifies the admin user creation in the seeds file by
removing the conditional check for the development environment.
As a result, the admin user will be created regardless of the
environment, which may need to be addressed to avoid unintended
consequences in production setups.
- Create admin user with email 'admin@example.com' and password 'password' for development environment
This change allows for easier development and testing by providing a default admin user.
- Update active status of various cities from false to true
- Ensures that all seeded cities are now enabled and available for usage
This change activates previously inactive cities in the seed files, which
facilitates their accessibility in subsequent deployments and testing.
The modification was made across numerous city seed files to ensure a
consistent state where all cities are now marked as active, improving
the readiness of the application.
- Created BatchGenerateWeatherArtsJob to process eligible
cities and generate weather art.
- Introduced GenerateWeatherArtJob for generating weather
art and image attachment.
- Added AiService for obtaining prompts and generating
images with OpenAI API.
- Implemented WeatherService to fetch current weather
data from the QWeather API.
- Updated Gemfile with necessary gems (whenever,
ruby-openai, httparty, down, aws-sdk-s3).
This commit introduces a system to create and store
weather art images for various cities based on current
weather conditions, leveraging external APIs for data
and image generation.
- Add slug column to weather_arts for friendly URLs.
- Update weather arts retrieval in the controller to use slug.
- Implement region and country filtering in cities index view.
- Optimize city queries with scopes for active status and region/country.
- Improve UI layout and design for the cities index page.
These changes allow better user experience by enabling cleaner URLs for weather arts and facilitating efficient filtering of cities based on selected regions and countries.
- Change city name display to localized name in both index and show views
- Modify schema to use bigint for certain foreign keys
- Correct country codes in seeds for accurate data representation
These changes improve the handling of city names, ensuring they are displayed in the appropriate localized format and ensuring well-typed foreign key relationships in the schema.
- Implement Country and Region models
- Establish relationships between City, Country, and Region
- Update ActiveAdmin setup for managing countries and regions
- Add localization support for cities and countries in multiple languages
- Create necessary migrations to support the new schema
This update allows for better categorization of cities under their respective countries and regions, enhancing geographical structure and support for multilingual features.
- Standardize string quotes in various files for consistency.
- Remove commented-out tests from cities and weather_arts controllers to improve readability.
- Clean up admin_users and weather_arts fixture files by commenting out unused entries instead of removing them.
These changes are aimed at enhancing code readability and maintainability, ensuring that code adheres to style guidelines without removing useful comments for future reference.
- Update weather date for existing record to 5 days ago
- Add new weather art record for 2 days ago with relevant details
- Include image attachment for the new weather art
This commit adds a second weather art record for Guangzhou reflecting the
weather conditions from 2 days ago, along with relevant data including
humidity, wind speed, and an updated visual representation.
- Integrate 'friendly_id' gem for sluggable functionality in City model
- Create ActiveAdmin resources for managing cities and weather arts
- Implement controller logic for cities
- Add database migrations for cities and weather arts creation
- Seed database with sample data for testing
- Create initial test cases for controllers and models
This commit enhances the application's URL handling by allowing friendly URLs for cities and weather arts. The addition of ActiveAdmin resources facilitates easier management through a web interface.