We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 31e3668 commit f0230eeCopy full SHA for f0230ee
lib/tasks/fetch_news.rake
@@ -76,12 +76,12 @@ namespace :news do
76
77
new_items.each do |new_item|
78
if existing_items_hash.key?(new_item['url'])
79
- # 既存アイテムの更新
80
existing_item = existing_items_hash[new_item['url']]
81
- updated_item = existing_item.merge(new_item) # 新しい情報で更新
82
- updated_items << updated_item
+ # タイトルまたは公開日が変わった場合のみ更新
+ if existing_item['title'] != new_item['title'] || existing_item['published_at'] != new_item['published_at']
+ updated_items << existing_item.merge(new_item)
83
+ end
84
else
- # 完全に新しいアイテム
85
truly_new_items << new_item
86
end
87
0 commit comments