refactor: tidy up code style and remove unused fields
- 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.
This commit is contained in:
parent
b4af78aa77
commit
7612dd6bd9
@ -33,4 +33,4 @@ class BatchGenerateWeatherArtsWorker
|
|||||||
.where("latest_arts.last_generation_time IS NULL OR latest_arts.last_generation_time < ?", cutoff_time)
|
.where("latest_arts.last_generation_time IS NULL OR latest_arts.last_generation_time < ?", cutoff_time)
|
||||||
.order(:priority)
|
.order(:priority)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -50,7 +50,7 @@ class GenerateWeatherArtWorker
|
|||||||
weather_art.image.attach(
|
weather_art.image.attach(
|
||||||
io: File.open(tempfile.path),
|
io: File.open(tempfile.path),
|
||||||
filename: generate_filename,
|
filename: generate_filename,
|
||||||
content_type: 'image/png'
|
content_type: "image/png"
|
||||||
)
|
)
|
||||||
|
|
||||||
weather_art
|
weather_art
|
||||||
@ -65,4 +65,4 @@ class GenerateWeatherArtWorker
|
|||||||
def generate_filename
|
def generate_filename
|
||||||
"#{city.country.name}-#{city.name.parameterize}-#{Time.current.strftime('%Y%m%d-%H%M%S')}.png"
|
"#{city.country.name}-#{city.name.parameterize}-#{Time.current.strftime('%Y%m%d-%H%M%S')}.png"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -3,6 +3,6 @@ class RemoveLastFetchFieldsFromCities < ActiveRecord::Migration[8.0]
|
|||||||
remove_column :cities, :last_weather_fetch
|
remove_column :cities, :last_weather_fetch
|
||||||
remove_column :cities, :last_image_generation
|
remove_column :cities, :last_image_generation
|
||||||
|
|
||||||
add_index :weather_arts, [:city_id, :weather_date]
|
add_index :weather_arts, [ :city_id, :weather_date ]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user