-
-
Notifications
You must be signed in to change notification settings - Fork 109
Rakeタスクのリファクタリング #1724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rakeタスクのリファクタリング #1724
Conversation
lib/tasks/import_news.rake
Outdated
| end | ||
|
|
||
| puts "Imported #{entries.size} items." | ||
| puts "Imported #{new_count + updated_count} items (#{new_count} new, #{updated_count} updated)." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
提案なので更新はお任せしますが、fetch_news.rake と同様に logger で出力する方法に揃えてあげても良さそうです📝
(出力の内容は良さそうです🙆♀️)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます!🙌
確かに logger 出力に揃えた方がスッキリすると思うので、fetch_news.rake と同様の logger 設定に変更します✨
rakuda-san-desu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
タスク実行時の更新状況も、よりわかりやすくなりました🙆♀️
1件コメントしていますが、このままでも問題ないと思うのでApproveしています。
対応ありがとうございます🙏✨
|
@rakuda-san-desu 何度もすみません🙏 |
rakuda-san-desu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
対応ありがとうございます!
ログの出力も確認しました🙆♀️
1件コメントしましたが、それ以外は良さそうです。
対応後、マージしていただければ🙏✨
lib/tasks/import_news.rake
Outdated
| new_count += 1 if is_new | ||
| updated_count += 1 unless is_new | ||
|
|
||
| logger.info "[News] #{news.published_at.to_date} #{news.title} (#{status})" # ← puts から logger.info に変更 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この部分のコメントは不要そうです✂️
それ以外は良さそうです!
対応ありがとうございます👍
|
修正対応全て完了し、テストもパスしたのでマージします🚀 |
Fixes. #1716
cf. #1704 (cf. #1577 )
lib/tasks/fetch_news.rake解決すべき問題
fetch_news.rake→ 差分がある場合のみ更新するように修正↪︎
titleまたはpublished_atに差分がある場合だけupdated_itemsに追加import_news.rake→ 更新があった場合のみsave!↪︎
news.changed?で変更があるか判定。新規 or 変更時だけ保存(既存データはそのまま)。
(ログに新規/更新のステータスも出力)