From 536b97a7da3854311d97a38ef64b0f1b7ac4d769 Mon Sep 17 00:00:00 2001 From: songtianlun Date: Sun, 2 Feb 2025 00:21:51 +0800 Subject: [PATCH] feat: update latest weather art display - Change latest weather art limit from 6 to 20 - Shuffle the collection and display the last 10 items - Update the section title to reflect the shuffling This commit enhances the visibility of the latest weather art by increasing the limit of displayed items. It randomizes the selection of the latest art pieces for a more dynamic user experience, while the UI title is updated to clarify this feature. This change improves user engagement with the content. --- app/controllers/home_controller.rb | 2 +- app/views/home/index.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 8329ff9..4fe3cb1 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,6 +1,6 @@ class HomeController < ApplicationController def index - @latest_arts = WeatherArt.includes(:city).order(created_at: :desc).limit(6) + @latest_arts = WeatherArt.includes(:city).order(created_at: :desc).limit(20).shuffle.last(10) @featured_arts = WeatherArt.includes(:city).order(created_at: :desc).limit(5) set_meta_tags( title: "AI-Generated Weather Art", diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 3d90bc3..36c1e16 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -25,7 +25,7 @@
-

Latest Weather Art

+

Shuffle Latest Weather Art

<% @latest_arts.each do |art| %>