Skip to content

Conversation

@yokomaru
Copy link
Contributor

@yokomaru yokomaru commented Dec 3, 2025

Issue

概要

  • 曜日配列がハードコーディングされている箇所が複数あり、可読性の低下や多言語対応の妨げになっているため曜日表示を I18nから取得するように変更する

今回の対応範囲

  • 以下形式で曜日配列がベタ書きされている箇所は I18n から取得するように修正
    • %w[日 月 火 水 木 金 土]I18n.t("date.abbr_day_names")に置き換え
    • %w[日曜日 月曜日 火曜日 水曜日 木曜日 金曜日 土曜日]I18n.t("date.day_names")に置き換え
  • 日付から曜日を取得する箇所は、配列参照ではなく I18n.l を使用して日付フォーマットから表示するように修正
  • セレクトボックスに曜日の2重配列を渡していた部分は、Rails7以降で利用可能なweekday_options_for_selectを使用するように変更
  • 日〜土までベタ書きで表示されていた箇所は I18n から取得した配列を利用するように統一

今回のPRでは対応せず別途対応する項目

変更確認方法

前提

  • このPRは曜日/日付の表示をI18nに委譲するリファクタが中心のため、保存値に影響しうる箇所のみ手動で重点確認し、それ以外が表示が問題ないかどうかを簡単に確認する
  • どのユーザーでの検証でもOK

セットアップ

  • chore/use_i18n_to_display_the_days_of_the_week をローカルに取り込む
  • foreman start -f Procfile.devでサーバー起動

定期イベント作成〜詳細〜編集

  • URL: http://localhost:3000/regular_events/new

検証項目

  • 定期開催日のドロップダウンに曜日が表示される
  • 並び順が日曜日始まりになっている(日曜日〜土曜日の順で表示されている)
  • 任意の曜日を選択し、必須項目を埋めて作成ボタンを押し登録できることを確認
    • 必須項目はタイトル、主催者、開始時間、終了時間、詳細
  • 保存後の詳細ページで、登録した任意の曜日が表示されている
  • そのイベントの編集画面を開き、選択した曜日が保持されている

検証動画

2026-01-11.0.44.59.mov

主な活動予定時間の登録〜マイページの確認

URL: http://localhost:3000/current_user/edit

登録情報変更内の主な活動予定時間の登録

検証項目
  • 日〜土までヘッダーが表示されていること
  • 任意の曜日と時間を学習時間として登録(後にマイページでの表示や活動時間別画面で使用するため)

マイページ

検証項目
  • 日〜土までヘッダーが表示されていること
  • 登録した曜日・時間が表示されていること

検証動画

2026-01-11.0.46.40.mov

登録情報変更内の主な活動予定時間

マイページ

スクリーンショット 2026-01-11 1 07 14

ニコニコカレンダー

URL: http://localhost:3000/users/253826460

  • 確認のため特定のユーザーのURLにしているが、生徒ユーザーであれば誰でもOK
検証項目
  • 日〜土までヘッダーが表示されていること
  • 日は赤文字になっていること
  • 土は青文字になっていること
検証画像

ユーザー一覧:活動時間別

URL: http://localhost:3000/users/activity_times

検証項目

  • ドロップダウンに曜日が表示される
  • 並び順が日曜日始まりになっている(日曜日〜土曜日の順で表示されている)
  • 現在の検索条件とドロップダウンの曜日が合っている
  • マイページで登録した曜日と学習時間を条件に検索すると自分が検索結果に含まれること

検証動画

2026-01-11.0.57.48.mov

企業別提出物一覧

URL: http://localhost:3000/companies/1022975240/products

検証項目

  • 提出日などの日付と曜日(YYYY年MM月DD日(曜日) HH:MM)が表示されていること

検証画像

スクリーンショット 2026-01-11 1 12 47

その他確認

Discord通知

  • Notification::RegularEventsTest#notify_coming_soon_regular_events内でpayloadに含まれる 今日/明日の開催 の日付と曜日表記を検証しているためCIが通っていればOK
bin/rails test test/system/notification/regular_events_test.rb
body['content'].include?('< 今日 (05/05 金) 開催 >') &&
body['content'].include?('< 明日 (05/06 土) 開催 >') &&

テスト関連の修正

  • CIが通っていればOK
bin/rails test test/system/admin/campaigns_test.rb
bin/rails test test/system/mentor/survey_questions_test.rb
bin/rails test test/system/regular_events/participation_test.rb

Screenshot

  • 表示ロジックの変更のみのため画面の変更はありません

Summary by CodeRabbit

  • 改善

    • 全体で曜日・日付表示をI18nに統一し、カレンダー、イベント表示、ユーザーの活動時間表、通知、テンプレート等がローカライズ表示に対応しました。
  • 削除

    • ローカル固定の曜日リストやそれに依存するヘルパー/定数を整理して削除しました。
  • テスト

    • 日付表示に関するシステム/ヘルパー系テストをI18n対応に更新しました。
  • 設定

    • 日本語ロケールに複数の新しい日時フォーマットを追加しました。

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 3, 2025

📝 Walkthrough

Walkthrough

アプリ全体でハードコードされた曜日名/曜日配列を Rails I18n(I18n.t / I18n.l)へ置換するリファクタ。ヘルパーおよびモデル定数の削除、ビュー/コントローラ/デコレータ/ノーティファイア/テストの参照更新、ja ロケールにフォーマット追加を含む。制御フローや機能の振る舞いは基本的に不変。

Changes

Cohort / File(s) 説明
ヘルパー削除
app/helpers/activity_times_helper.rb, app/helpers/users_helper.rb
公開ヘルパーメソッド(day_names_with_suffix / day_of_the_week)を削除。静的な曜日配列の提供をやめ、I18n を利用する前提に。
モデル定数削除
app/models/regular_event.rb
DAY_OF_THE_WEEK_LIST 定数を削除。ビュー/デコレータ側で I18n を利用するよう変更。
コントローラ / デコレータ / ノーティファイア
app/controllers/users/activity_times_controller.rb, app/decorators/regular_event_decorator.rb, app/notifiers/discord_notifier.rb
曜日名参照をヘルパー/定数から I18n.t('date.*') / I18n.l に置換。クエリ・ロジックや制御フローは変更なし。
ビュー(複数)
app/views/companies/products/_product.html.slim, app/views/regular_events/_regular_event_repeat_rule_fields.html.slim, app/views/users/_learning_time_frames.html.slim, app/views/users/activity_times/_activity_time_tabs.html.slim, app/views/users/activity_times/index.html.slim, app/views/users/form/_learning_time_frames.html.slim, app/components/calendar/nico_nico_calendar_component.html.slim
各所で曜日表示/選択肢を I18n ベースへ移行。日時表示には I18n.l を使用する箇所を追加。クラス付与や条件表示は維持。
ロケール追加
config/locales/ja.yml
ja.time.formatsmdw, day_name(および関連フォーマット)を追加。
テスト更新
test/helpers/activity_times_helper_test.rb, test/system/mentor/survey_questions_test.rb, test/system/regular_events/participation_test.rb, test/system/admin/campaigns_test.rb
削除されたヘルパーテストの除去、テスト内の日時/曜日表現を I18n.l ベースに置換。
その他小変更
app/components/..., app/views/...(多数)
ビュー上の個別の日付組立てを I18n.l の単一フォーマットへ置換し、重複コードを削減。

Sequence Diagram(s)

(該当なし)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • komagata
  • hirokiej

Poem

🐰
曜日の殻をそっと脱いで、
言葉はもう国際化の風に乗る。
I18n の畑でぴょんと跳ねて、
今日は何曜日? ちゃんと答えるよ。

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed PRタイトルは、プロジェクト内のハードコーディングされた曜日配列をrails-i18nを使用したコードに置き換えるという、このPRの主要な変更内容を簡潔かつ明確に表しています。
Description check ✅ Passed PRの説明は、テンプレートの必須セクション(Issue、概要)を含み、詳細な変更内容と検証手順が記載されている。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yokomaru yokomaru self-assigned this Dec 4, 2025
@yokomaru yokomaru force-pushed the chore/use_i18n_to_display_the_days_of_the_week branch 2 times, most recently from 9eea8eb to ebbb79d Compare December 10, 2025 16:11
@yokomaru yokomaru marked this pull request as ready for review December 10, 2025 16:12
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
app/views/users/activity_times/_activity_time_tabs.html.slim (1)

8-13: ボタン表記も day_names ヘルパー経由に寄せると一貫しそうです

現状、ドロップダウンボタンのラベルは I18n.t('date.day_names')[clamp_day_index(@target_day_of_week)]、メニュー項目は day_names.each_with_index と、曜日配列の取得経路が分かれています。どちらも同じ配列を意図しているなら、次のようにボタン側も day_names を使うと、今後 day_names の実装を変えた際にも表示が揃いやすくなります(動作上は現状のままでも問題ありません)。

-            button.dropdown-button type="button" data-target="day-dropdown"
-              span.dropdown-button__text = I18n.t('date.day_names')[clamp_day_index(@target_day_of_week)]
+            button.dropdown-button type="button" data-target="day-dropdown"
+              span.dropdown-button__text = day_names[clamp_day_index(@target_day_of_week)]
app/controllers/users/activity_times_controller.rb (1)

29-38: week_day カラムと I18n ロケールの紐付きについてのメモ

week_day_name = I18n.t('date.abbr_day_names')[day_of_week.to_i] によって、learning_time_frames.week_day には現在の I18n.localedate.abbr_day_names(現状は ja の「日〜土」)が保存されている/照会されている前提になります。

アプリ全体を日本語ロケール固定で運用する前提であればこの実装で問題ありませんが、将来的にユーザーごとにロケールを切り替えたくなった場合、このクエリがヒットしなくなる可能性があります。そのときは例えば:

  • I18n.t('date.abbr_day_names', locale: I18n.default_locale)[day_of_week.to_i] のようにロケールを固定する
  • もしくは DB 側の week_day を整数(0〜6)に統一し、表示だけ I18n に任せる

といった方向も検討できそうです。現時点では設計メモ・改善余地レベルの話なので、別 Issue/PR での対応でも良いと思います。

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between faa809b and ebbb79d.

📒 Files selected for processing (18)
  • app/controllers/users/activity_times_controller.rb (1 hunks)
  • app/decorators/regular_event_decorator.rb (1 hunks)
  • app/helpers/activity_times_helper.rb (0 hunks)
  • app/helpers/products_helper.rb (1 hunks)
  • app/helpers/regular_events_helper.rb (1 hunks)
  • app/helpers/users_helper.rb (0 hunks)
  • app/models/regular_event.rb (0 hunks)
  • app/notifiers/discord_notifier.rb (1 hunks)
  • app/views/companies/products/_product.html.slim (7 hunks)
  • app/views/regular_events/_regular_event_repeat_rule_fields.html.slim (1 hunks)
  • app/views/users/_learning_time_frames.html.slim (1 hunks)
  • app/views/users/activity_times/_activity_time_tabs.html.slim (1 hunks)
  • app/views/users/activity_times/index.html.slim (1 hunks)
  • app/views/users/form/_learning_time_frames.html.slim (1 hunks)
  • test/helpers/activity_times_helper_test.rb (0 hunks)
  • test/system/admin/campaigns_test.rb (0 hunks)
  • test/system/mentor/survey_questions_test.rb (5 hunks)
  • test/system/regular_events/participation_test.rb (2 hunks)
💤 Files with no reviewable changes (5)
  • app/helpers/users_helper.rb
  • test/system/admin/campaigns_test.rb
  • test/helpers/activity_times_helper_test.rb
  • app/models/regular_event.rb
  • app/helpers/activity_times_helper.rb
🧰 Additional context used
📓 Path-based instructions (6)
app/**/*.{rb,js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Rails app code should be organized in app/ directory with subdirectories: models/, controllers/, views/, jobs/, helpers/, and frontend code under javascript/ (Shakapacker)

Files:

  • app/helpers/products_helper.rb
  • app/notifiers/discord_notifier.rb
  • app/helpers/regular_events_helper.rb
  • app/controllers/users/activity_times_controller.rb
  • app/decorators/regular_event_decorator.rb
**/*.rb

📄 CodeRabbit inference engine (AGENTS.md)

Ruby code should use 2-space indentation, snake_case for method names, and CamelCase for class names, enforced by RuboCop (.rubocop.yml)

Files:

  • app/helpers/products_helper.rb
  • test/system/regular_events/participation_test.rb
  • app/notifiers/discord_notifier.rb
  • test/system/mentor/survey_questions_test.rb
  • app/helpers/regular_events_helper.rb
  • app/controllers/users/activity_times_controller.rb
  • app/decorators/regular_event_decorator.rb

⚙️ CodeRabbit configuration file

**/*.rb: # refactoring

  • まずFat Controllerを避け、次にFat Modelを避ける。
  • Serviceクラスの乱用を避ける。
  • controller concernを作ろうとしたらPORO(Plain Old Ruby Object)やActiveRecordモデルでの実装で代替できないか検討する。

Rails Patterns

  • ViewHelperにメソッドを実装する時にはまずDecoratorパターンを使うことを検討する。(active_decorator gemを導入しているのでそれを使う)
  • 複雑なActiveRecordクエリがあり、再利用できそうな場合はQueryObjectパターンを検討する。(rails-patterns gemを導入しているのでそれのQuery機能を使う)
  • Viewにpartialを作る場合はViewComponentを使うことを検討する。
  • 複数のActiveRecordモデルを操作する1つの責務がある時や外部APIとやりとりする処理がある場合にはInteractorオブジェクトパターンを検討する。(interactor gemを導入しているのでそれを使う)
  • 複数のInteractorを実行するような処理がある場合Organizerオブジェクトパターンを検討する。(interactor gemを導入しており、その中にOrganizerの機能があるので使う)

Files:

  • app/helpers/products_helper.rb
  • test/system/regular_events/participation_test.rb
  • app/notifiers/discord_notifier.rb
  • test/system/mentor/survey_questions_test.rb
  • app/helpers/regular_events_helper.rb
  • app/controllers/users/activity_times_controller.rb
  • app/decorators/regular_event_decorator.rb
**/*.slim

📄 CodeRabbit inference engine (AGENTS.md)

Slim templates should be linted according to config/slim_lint.yml

Files:

  • app/views/users/activity_times/index.html.slim
  • app/views/users/_learning_time_frames.html.slim
  • app/views/regular_events/_regular_event_repeat_rule_fields.html.slim
  • app/views/users/activity_times/_activity_time_tabs.html.slim
  • app/views/users/form/_learning_time_frames.html.slim
  • app/views/companies/products/_product.html.slim
test/**/*_test.rb

📄 CodeRabbit inference engine (AGENTS.md)

test/**/*_test.rb: Test suite should use Minitest with structure: system/, models/, controllers/, and fixtures in test/fixtures/; test files should be named *_test.rb
Use Minitest + Capybara for system tests; place unit and integration tests under matching test/* directories

Files:

  • test/system/regular_events/participation_test.rb
  • test/system/mentor/survey_questions_test.rb
test/**

📄 CodeRabbit inference engine (AGENTS.md)

Keep tests deterministic and use fixtures stored in test/fixtures/ for test data

Files:

  • test/system/regular_events/participation_test.rb
  • test/system/mentor/survey_questions_test.rb
test/**/*

⚙️ CodeRabbit configuration file

test/**/*: # Test

  • TestCase名は英語で書く。
  • どうしても避けられない時以外にsystem testでsleepは使わない。

Unit Test

model, helper, decorator, view_componentについてはメソッドを追加した場合は必ず対応したUnit TestのTestCaseを1つは書く。

Files:

  • test/system/regular_events/participation_test.rb
  • test/system/mentor/survey_questions_test.rb
🧠 Learnings (3)
📓 Common learnings
Learnt from: hirokiej
Repo: fjordllc/bootcamp PR: 8740
File: app/helpers/reports_helper.rb:56-64
Timestamp: 2025-06-29T03:44:15.179Z
Learning: このプロジェクト(fjordllc/bootcamp)では、ja.ymlファイルで一部の単語や文章のみI18n対応されているが、多くのテキストは日本語でハードコーディングされており、完全な国際化対応は行われていない。新しい機能でもI18n対応は不要と判断される。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: app/controllers/mentor/buzzes_controller.rb:0-0
Timestamp: 2025-09-04T01:39:22.261Z
Learning: fjordllc/bootcamp プロジェクトでは、更新処理の成功時の通知メッセージについて、I18n を使用せずに日本語文字列を直接記述する方針で一貫性を保っている。
Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 0
File: :0-0
Timestamp: 2025-07-23T20:42:19.974Z
Learning: fjordllc/bootcampプロジェクトでは、hタグ(見出し)の文言は日本語でハードコーディングする方針が確立されており、I18n対応は行わない。例:app/views/welcome/logo.html.slimでh2、h3タグが日本語でハードコーディングされている。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 9115
File: db/migrate/20250902024949_add_unique_index_to_correct_answers.rb:1-5
Timestamp: 2025-11-13T09:20:36.030Z
Learning: fjordllc/bootcamp プロジェクトでは、データの整合性を保つためのデータ修正には data-migrate gem を使用し、db/data/ ディレクトリ配下にデータマイグレーションファイルを作成する運用を採用している。スキーマ変更(db/migrate/)とデータ変更(db/data/)を分離することで、より安全で管理しやすい構成を実現している。
📚 Learning: 2025-08-31T23:39:23.210Z
Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: app/views/pair_works/_body.html.slim:111-117
Timestamp: 2025-08-31T23:39:23.210Z
Learning: PairWorkモデルにreserved_at_in_schedules?カスタムバリデーション(on: :update)が実装されており、reserved_atが必ずschedules.map(&:proposed_at)に含まれることを検証している。これにより、フォームから任意の日時を送信することを防いでいる。

Applied to files:

  • test/system/regular_events/participation_test.rb
  • app/views/regular_events/_regular_event_repeat_rule_fields.html.slim
📚 Learning: 2025-11-26T08:23:30.927Z
Learnt from: CR
Repo: fjordllc/bootcamp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T08:23:30.927Z
Learning: Applies to test/**/*_test.rb : Use Minitest + Capybara for system tests; place unit and integration tests under matching `test/*` directories

Applied to files:

  • test/system/mentor/survey_questions_test.rb
🧬 Code graph analysis (5)
app/helpers/products_helper.rb (1)
test/system/mentor/survey_questions_test.rb (1)
  • t (5-94)
test/system/regular_events/participation_test.rb (1)
test/system/mentor/survey_questions_test.rb (1)
  • t (5-94)
app/notifiers/discord_notifier.rb (1)
test/system/mentor/survey_questions_test.rb (1)
  • t (5-94)
app/controllers/users/activity_times_controller.rb (1)
test/system/mentor/survey_questions_test.rb (1)
  • t (5-94)
app/decorators/regular_event_decorator.rb (1)
test/system/mentor/survey_questions_test.rb (1)
  • t (5-94)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (9)
app/notifiers/discord_notifier.rb (1)

69-69: LGTM!

I18n.t('date.abbr_day_names')[date.wday] への変更は適切です。date.wday のインデックス(0=日曜日)と abbr_day_names 配列の順序が一致しています。

test/system/regular_events/participation_test.rb (2)

49-49: LGTM!

I18n ベースの曜日名への変更は適切です。date.day_names を使用して完全な曜日名(例:「月曜日」)を取得しています。


59-59: LGTM!

アサーションも I18n ベースの曜日名に一貫して変更されています。

app/views/regular_events/_regular_event_repeat_rule_fields.html.slim (1)

16-16: LGTM!

day_names_and_index_options ヘルパーを使用することで、曜日オプションが I18n から動的に取得されるようになりました。

app/views/users/form/_learning_time_frames.html.slim (1)

14-15: LGTM!

テーブルヘッダーに I18n.t('date.abbr_day_names') を使用することで、曜日の略称が I18n から取得されるようになりました。

test/system/mentor/survey_questions_test.rb (1)

6-6: LGTM!

クラスレベルで DAYS_OF_THE_WEEK 定数を定義し、I18n から曜日略称を取得するようにしたのは良い変更です。テスト全体で一貫して使用されています。

app/helpers/regular_events_helper.rb (1)

3-6: LGTM!

day_names_and_index_options ヘルパーは、select オプション用に [曜日名, インデックス] のペア配列を適切に生成しています。実装もシンプルで良いです。

app/views/users/_learning_time_frames.html.slim (1)

10-11: I18n を使った曜日ヘッダへの置き換えは問題なさそうです

I18n.t('date.abbr_day_names') をそのままループに使う形になっており、ベタ書き配列が消えてメンテしやすくなっています。動作面で特に懸念はありません。

app/decorators/regular_event_decorator.rb (1)

7-8: holding_day_of_the_week の I18n 置き換えは妥当です

repeat_rule.day_of_the_week が 0〜6 の整数であれば、I18n.t('date.day_names')[index] は従来の DAY_OF_THE_WEEK_LIST 相当の「日曜日〜土曜日」を返すので、挙動は変えずに定義元だけを I18n に寄せられていると思います。

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
app/decorators/regular_event_decorator.rb (1)

7-7: 配列の範囲外アクセスに対する防御的なコーディングを検討してください。

repeat_rule.day_of_the_week が 0-6 の範囲外の値である場合、I18n.t('date.day_names')[repeat_rule.day_of_the_week]nil を返します。データベース制約で保護されていると思われますが、明示的なチェックを追加することでより堅牢になります。

🔎 防御的なコードの提案
-      holding_day_of_the_week = I18n.t('date.day_names')[repeat_rule.day_of_the_week]
+      day_names = I18n.t('date.day_names')
+      holding_day_of_the_week = day_names[repeat_rule.day_of_the_week] || day_names[0]
app/helpers/products_helper.rb (1)

4-6: nil 入力に対する防御的なコーディングを検討してください。

datenil の場合、date.wdayNoMethodError を発生させます。ビュー側で date が常に存在することを保証している場合は問題ありませんが、明示的な nil チェックを追加することでより堅牢になります。

🔎 nil ガードの提案
 def abbr_day_name(date)
+  return '' if date.nil?
   I18n.t('date.abbr_day_names')[date.wday]
 end
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d4777dd and cdc49a6.

📒 Files selected for processing (20)
  • app/controllers/users/activity_times_controller.rb (1 hunks)
  • app/decorators/regular_event_decorator.rb (1 hunks)
  • app/helpers/activity_times_helper.rb (0 hunks)
  • app/helpers/products_helper.rb (1 hunks)
  • app/helpers/regular_events_helper.rb (1 hunks)
  • app/helpers/users_helper.rb (0 hunks)
  • app/models/regular_event.rb (0 hunks)
  • app/notifiers/discord_notifier.rb (1 hunks)
  • app/views/companies/products/_product.html.slim (7 hunks)
  • app/views/regular_events/_regular_event_repeat_rule_fields.html.slim (1 hunks)
  • app/views/users/_learning_time_frames.html.slim (1 hunks)
  • app/views/users/activity_times/_activity_time_tabs.html.slim (1 hunks)
  • app/views/users/activity_times/index.html.slim (1 hunks)
  • app/views/users/form/_learning_time_frames.html.slim (1 hunks)
  • test/helpers/activity_times_helper_test.rb (0 hunks)
  • test/helpers/products_helper_test.rb (1 hunks)
  • test/helpers/regular_events_helper_test.rb (1 hunks)
  • test/system/admin/campaigns_test.rb (0 hunks)
  • test/system/mentor/survey_questions_test.rb (5 hunks)
  • test/system/regular_events/participation_test.rb (2 hunks)
💤 Files with no reviewable changes (5)
  • test/helpers/activity_times_helper_test.rb
  • app/helpers/activity_times_helper.rb
  • test/system/admin/campaigns_test.rb
  • app/models/regular_event.rb
  • app/helpers/users_helper.rb
🚧 Files skipped from review as they are similar to previous changes (9)
  • app/views/users/form/_learning_time_frames.html.slim
  • app/views/regular_events/_regular_event_repeat_rule_fields.html.slim
  • app/notifiers/discord_notifier.rb
  • app/views/companies/products/_product.html.slim
  • app/views/users/_learning_time_frames.html.slim
  • test/system/mentor/survey_questions_test.rb
  • app/views/users/activity_times/_activity_time_tabs.html.slim
  • test/system/regular_events/participation_test.rb
  • app/views/users/activity_times/index.html.slim
🧰 Additional context used
📓 Path-based instructions (5)
app/**/*.{rb,js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Rails app code should be organized in app/ directory with subdirectories: models/, controllers/, views/, jobs/, helpers/, and frontend code under javascript/ (Shakapacker)

Files:

  • app/decorators/regular_event_decorator.rb
  • app/helpers/regular_events_helper.rb
  • app/helpers/products_helper.rb
  • app/controllers/users/activity_times_controller.rb
**/*.rb

📄 CodeRabbit inference engine (AGENTS.md)

Ruby code should use 2-space indentation, snake_case for method names, and CamelCase for class names, enforced by RuboCop (.rubocop.yml)

Files:

  • app/decorators/regular_event_decorator.rb
  • app/helpers/regular_events_helper.rb
  • app/helpers/products_helper.rb
  • app/controllers/users/activity_times_controller.rb
  • test/helpers/products_helper_test.rb
  • test/helpers/regular_events_helper_test.rb

⚙️ CodeRabbit configuration file

**/*.rb: # refactoring

  • まずFat Controllerを避け、次にFat Modelを避ける。
  • Serviceクラスの乱用を避ける。
  • controller concernを作ろうとしたらPORO(Plain Old Ruby Object)やActiveRecordモデルでの実装で代替できないか検討する。

Rails Patterns

  • ViewHelperにメソッドを実装する時にはまずDecoratorパターンを使うことを検討する。(active_decorator gemを導入しているのでそれを使う)
  • 複雑なActiveRecordクエリがあり、再利用できそうな場合はQueryObjectパターンを検討する。(rails-patterns gemを導入しているのでそれのQuery機能を使う)
  • Viewにpartialを作る場合はViewComponentを使うことを検討する。
  • 複数のActiveRecordモデルを操作する1つの責務がある時や外部APIとやりとりする処理がある場合にはInteractorオブジェクトパターンを検討する。(interactor gemを導入しているのでそれを使う)
  • 複数のInteractorを実行するような処理がある場合Organizerオブジェクトパターンを検討する。(interactor gemを導入しており、その中にOrganizerの機能があるので使う)

Files:

  • app/decorators/regular_event_decorator.rb
  • app/helpers/regular_events_helper.rb
  • app/helpers/products_helper.rb
  • app/controllers/users/activity_times_controller.rb
  • test/helpers/products_helper_test.rb
  • test/helpers/regular_events_helper_test.rb
test/**/*_test.rb

📄 CodeRabbit inference engine (AGENTS.md)

test/**/*_test.rb: Test suite should use Minitest with structure: system/, models/, controllers/, and fixtures in test/fixtures/; test files should be named *_test.rb
Use Minitest + Capybara for system tests; place unit and integration tests under matching test/* directories

Files:

  • test/helpers/products_helper_test.rb
  • test/helpers/regular_events_helper_test.rb
test/**

📄 CodeRabbit inference engine (AGENTS.md)

Keep tests deterministic and use fixtures stored in test/fixtures/ for test data

Files:

  • test/helpers/products_helper_test.rb
  • test/helpers/regular_events_helper_test.rb
test/**/*

⚙️ CodeRabbit configuration file

test/**/*: # Test

  • TestCase名は英語で書く。
  • どうしても避けられない時以外にsystem testでsleepは使わない。

Unit Test

model, helper, decorator, view_componentについてはメソッドを追加した場合は必ず対応したUnit TestのTestCaseを1つは書く。

Files:

  • test/helpers/products_helper_test.rb
  • test/helpers/regular_events_helper_test.rb
🧠 Learnings (9)
📓 Common learnings
Learnt from: hirokiej
Repo: fjordllc/bootcamp PR: 8740
File: app/helpers/reports_helper.rb:56-64
Timestamp: 2025-06-29T03:44:15.179Z
Learning: このプロジェクト(fjordllc/bootcamp)では、ja.ymlファイルで一部の単語や文章のみI18n対応されているが、多くのテキストは日本語でハードコーディングされており、完全な国際化対応は行われていない。新しい機能でもI18n対応は不要と判断される。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: app/controllers/mentor/buzzes_controller.rb:0-0
Timestamp: 2025-09-04T01:39:22.261Z
Learning: fjordllc/bootcamp プロジェクトでは、更新処理の成功時の通知メッセージについて、I18n を使用せずに日本語文字列を直接記述する方針で一貫性を保っている。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。
Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 0
File: :0-0
Timestamp: 2025-07-23T20:42:19.974Z
Learning: fjordllc/bootcampプロジェクトでは、hタグ(見出し)の文言は日本語でハードコーディングする方針が確立されており、I18n対応は行わない。例:app/views/welcome/logo.html.slimでh2、h3タグが日本語でハードコーディングされている。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 9115
File: db/migrate/20250902024949_add_unique_index_to_correct_answers.rb:1-5
Timestamp: 2025-11-13T09:20:36.030Z
Learning: fjordllc/bootcamp プロジェクトでは、データの整合性を保つためのデータ修正には data-migrate gem を使用し、db/data/ ディレクトリ配下にデータマイグレーションファイルを作成する運用を採用している。スキーマ変更(db/migrate/)とデータ変更(db/data/)を分離することで、より安全で管理しやすい構成を実現している。
📚 Learning: 2025-09-12T21:18:00.834Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。

Applied to files:

  • app/helpers/products_helper.rb
📚 Learning: 2025-09-12T21:16:47.639Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。

Applied to files:

  • app/helpers/products_helper.rb
📚 Learning: 2025-09-12T21:17:26.029Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:19-23
Timestamp: 2025-09-12T21:17:26.029Z
Learning: Rails アップグレードPRにおいて、config_for(:secrets) を使った webhook URL 設定の shared セクション未参照問題は、設定システム全体の変更として別PRで対応すべきである。

Applied to files:

  • app/helpers/products_helper.rb
📚 Learning: 2025-09-12T21:17:45.295Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:52-56
Timestamp: 2025-09-12T21:17:45.295Z
Learning: Rails upgrade PRにおいて、configuration systemの改善提案(shared configuration fallback等)も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。

Applied to files:

  • app/helpers/products_helper.rb
📚 Learning: 2025-09-04T01:39:22.261Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: app/controllers/mentor/buzzes_controller.rb:0-0
Timestamp: 2025-09-04T01:39:22.261Z
Learning: fjordllc/bootcamp プロジェクトでは、更新処理の成功時の通知メッセージについて、I18n を使用せずに日本語文字列を直接記述する方針で一貫性を保っている。

Applied to files:

  • app/helpers/products_helper.rb
📚 Learning: 2025-09-01T22:31:57.345Z
Learnt from: matuaya
Repo: fjordllc/bootcamp PR: 9108
File: app/models/after_user_retirement.rb:0-0
Timestamp: 2025-09-01T22:31:57.345Z
Learning: fjordllc/bootcampプロジェクトにおいて、`Newspaper.publish(:retirement_create, { user: user })`はUnfinishedDataDestroyer(未チェックProduct・WIP Report削除、career_pathリセット)とTimesChannelDestroyer(Discord分報チャンネル削除)による重要なデータクリーンアップ処理を実行するため、退会のトリガーが何であろうと(admin、hibernation、user)必ず実行する必要がある。

Applied to files:

  • app/helpers/products_helper.rb
📚 Learning: 2025-11-26T08:23:30.927Z
Learnt from: CR
Repo: fjordllc/bootcamp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T08:23:30.927Z
Learning: Applies to test/**/*_test.rb : Test suite should use Minitest with structure: `system/`, `models/`, `controllers/`, and fixtures in `test/fixtures/`; test files should be named `*_test.rb`

Applied to files:

  • test/helpers/products_helper_test.rb
📚 Learning: 2025-11-26T08:23:30.927Z
Learnt from: CR
Repo: fjordllc/bootcamp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T08:23:30.927Z
Learning: Applies to test/**/*_test.rb : Use Minitest + Capybara for system tests; place unit and integration tests under matching `test/*` directories

Applied to files:

  • test/helpers/products_helper_test.rb
  • test/helpers/regular_events_helper_test.rb
🧬 Code graph analysis (2)
test/helpers/products_helper_test.rb (1)
app/helpers/products_helper.rb (1)
  • abbr_day_name (4-6)
test/helpers/regular_events_helper_test.rb (1)
app/helpers/regular_events_helper.rb (1)
  • day_of_the_week_options_for_regular_event (4-6)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (2)
app/helpers/regular_events_helper.rb (1)

3-6: 実装が適切です。

I18n を使用して曜日オプションを生成する実装は正しく、Rails の select オプション形式 [表示名, 値] に適合しています。with_index の使用により、曜日の順序とインデックスが適切に対応付けられています。

app/controllers/users/activity_times_controller.rb (1)

32-32: データベースの曜日形式との整合性を確認してください。

learning_time_frames.week_day カラムに格納されている値が、I18n.t('date.abbr_day_names') から取得される略称形式('日', '月', '火' など)と一致していることを確認する必要があります。もし完全な曜日名('日曜日', '月曜日' など)や他の形式で保存されている場合、このクエリは期待通りに動作しません。

以下のスクリプトで learning_time_frames.week_day に保存されている実際の値を確認してください:

#!/bin/bash
# Description: Check the actual values stored in learning_time_frames.week_day column

rg -nP "week_day\s*[:=]" --type=rb -A2 -B2

@yokomaru yokomaru force-pushed the chore/use_i18n_to_display_the_days_of_the_week branch from cdc49a6 to 52ecbff Compare December 24, 2025 05:30
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/views/companies/products/_product.html.slim (1)

29-29: lI18n.l の使用が混在しています。

Line 29 では l ヘルパーを使用し、Line 34 以降では I18n.l を明示的に使用しています。機能的には同じですが、一貫性のためにどちらかに統一することを推奨します。

🔎 統一案
              .card-list-item-meta__item
                time.a-meta
                  span.a-meta__label 提出
-                  | #{l product.published_at, format: :default_with_space}
+                  | #{I18n.l(product.published_at, format: :default_with_space)}

Also applies to: 34-34

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cdc49a6 and 52ecbff.

📒 Files selected for processing (17)
  • app/components/calendar/nico_nico_calendar_component.html.slim
  • app/controllers/users/activity_times_controller.rb
  • app/decorators/regular_event_decorator.rb
  • app/helpers/activity_times_helper.rb
  • app/helpers/users_helper.rb
  • app/models/regular_event.rb
  • app/notifiers/discord_notifier.rb
  • app/views/companies/products/_product.html.slim
  • app/views/regular_events/_regular_event_repeat_rule_fields.html.slim
  • app/views/users/_learning_time_frames.html.slim
  • app/views/users/activity_times/_activity_time_tabs.html.slim
  • app/views/users/activity_times/index.html.slim
  • app/views/users/form/_learning_time_frames.html.slim
  • config/locales/ja.yml
  • test/helpers/activity_times_helper_test.rb
  • test/system/mentor/survey_questions_test.rb
  • test/system/regular_events/participation_test.rb
💤 Files with no reviewable changes (4)
  • app/models/regular_event.rb
  • app/helpers/users_helper.rb
  • app/helpers/activity_times_helper.rb
  • test/helpers/activity_times_helper_test.rb
🚧 Files skipped from review as they are similar to previous changes (8)
  • app/views/regular_events/_regular_event_repeat_rule_fields.html.slim
  • test/system/mentor/survey_questions_test.rb
  • app/controllers/users/activity_times_controller.rb
  • app/decorators/regular_event_decorator.rb
  • app/views/users/activity_times/_activity_time_tabs.html.slim
  • app/notifiers/discord_notifier.rb
  • app/views/users/activity_times/index.html.slim
  • app/views/users/_learning_time_frames.html.slim
🧰 Additional context used
📓 Path-based instructions (6)
**/*.slim

📄 CodeRabbit inference engine (AGENTS.md)

Slim templates should be linted according to config/slim_lint.yml

Files:

  • app/components/calendar/nico_nico_calendar_component.html.slim
  • app/views/companies/products/_product.html.slim
  • app/views/users/form/_learning_time_frames.html.slim
config/**

📄 CodeRabbit inference engine (AGENTS.md)

Configuration files in config/ should include environment settings, routes, and lints (.rubocop.yml, config/slim_lint.yml)

Files:

  • config/locales/ja.yml
test/**/*_test.rb

📄 CodeRabbit inference engine (AGENTS.md)

test/**/*_test.rb: Test suite should use Minitest with structure: system/, models/, controllers/, and fixtures in test/fixtures/; test files should be named *_test.rb
Use Minitest + Capybara for system tests; place unit and integration tests under matching test/* directories

Files:

  • test/system/regular_events/participation_test.rb
**/*.rb

📄 CodeRabbit inference engine (AGENTS.md)

Ruby code should use 2-space indentation, snake_case for method names, and CamelCase for class names, enforced by RuboCop (.rubocop.yml)

Files:

  • test/system/regular_events/participation_test.rb

⚙️ CodeRabbit configuration file

**/*.rb: # refactoring

  • まずFat Controllerを避け、次にFat Modelを避ける。
  • Serviceクラスの乱用を避ける。
  • controller concernを作ろうとしたらPORO(Plain Old Ruby Object)やActiveRecordモデルでの実装で代替できないか検討する。

Rails Patterns

  • ViewHelperにメソッドを実装する時にはまずDecoratorパターンを使うことを検討する。(active_decorator gemを導入しているのでそれを使う)
  • 複雑なActiveRecordクエリがあり、再利用できそうな場合はQueryObjectパターンを検討する。(rails-patterns gemを導入しているのでそれのQuery機能を使う)
  • Viewにpartialを作る場合はViewComponentを使うことを検討する。
  • 複数のActiveRecordモデルを操作する1つの責務がある時や外部APIとやりとりする処理がある場合にはInteractorオブジェクトパターンを検討する。(interactor gemを導入しているのでそれを使う)
  • 複数のInteractorを実行するような処理がある場合Organizerオブジェクトパターンを検討する。(interactor gemを導入しており、その中にOrganizerの機能があるので使う)

Files:

  • test/system/regular_events/participation_test.rb
test/**

📄 CodeRabbit inference engine (AGENTS.md)

Keep tests deterministic and use fixtures stored in test/fixtures/ for test data

Files:

  • test/system/regular_events/participation_test.rb
test/**/*

⚙️ CodeRabbit configuration file

test/**/*: # Test

  • TestCase名は英語で書く。
  • どうしても避けられない時以外にsystem testでsleepは使わない。

Unit Test

model, helper, decorator, view_componentについてはメソッドを追加した場合は必ず対応したUnit TestのTestCaseを1つは書く。

Files:

  • test/system/regular_events/participation_test.rb
🧠 Learnings (12)
📓 Common learnings
Learnt from: hirokiej
Repo: fjordllc/bootcamp PR: 8740
File: app/helpers/reports_helper.rb:56-64
Timestamp: 2025-06-29T03:44:15.179Z
Learning: このプロジェクト(fjordllc/bootcamp)では、ja.ymlファイルで一部の単語や文章のみI18n対応されているが、多くのテキストは日本語でハードコーディングされており、完全な国際化対応は行われていない。新しい機能でもI18n対応は不要と判断される。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: app/controllers/mentor/buzzes_controller.rb:0-0
Timestamp: 2025-09-04T01:39:22.261Z
Learning: fjordllc/bootcamp プロジェクトでは、更新処理の成功時の通知メッセージについて、I18n を使用せずに日本語文字列を直接記述する方針で一貫性を保っている。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。
Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 0
File: :0-0
Timestamp: 2025-07-23T20:42:19.974Z
Learning: fjordllc/bootcampプロジェクトでは、hタグ(見出し)の文言は日本語でハードコーディングする方針が確立されており、I18n対応は行わない。例:app/views/welcome/logo.html.slimでh2、h3タグが日本語でハードコーディングされている。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:52-56
Timestamp: 2025-09-12T21:17:45.295Z
Learning: Rails upgrade PRにおいて、configuration systemの改善提案(shared configuration fallback等)も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/product.rb:59-61
Timestamp: 2025-09-11T14:47:53.256Z
Learning: Rails アップグレードPRでは、アップグレードに直接関連しない性能改善や機能追加の提案は避けるべき。PRのスコープを維持することが重要で、そのような改善提案は別PRで対応すべきである。
📚 Learning: 2025-09-12T21:18:00.834Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-09-04T01:39:22.261Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: app/controllers/mentor/buzzes_controller.rb:0-0
Timestamp: 2025-09-04T01:39:22.261Z
Learning: fjordllc/bootcamp プロジェクトでは、更新処理の成功時の通知メッセージについて、I18n を使用せずに日本語文字列を直接記述する方針で一貫性を保っている。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-11-13T09:20:36.030Z
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 9115
File: db/migrate/20250902024949_add_unique_index_to_correct_answers.rb:1-5
Timestamp: 2025-11-13T09:20:36.030Z
Learning: fjordllc/bootcamp プロジェクトでは、データの整合性を保つためのデータ修正には data-migrate gem を使用し、db/data/ ディレクトリ配下にデータマイグレーションファイルを作成する運用を採用している。スキーマ変更(db/migrate/)とデータ変更(db/data/)を分離することで、より安全で管理しやすい構成を実現している。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-09-04T01:50:47.773Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: db/migrate/20250831234516_remove_unique_index_from_buzzes_title.rb:1-5
Timestamp: 2025-09-04T01:50:47.773Z
Learning: fjordllc/bootcampプロジェクトでは、マイグレーションにおいてdisable_ddl_transaction!やalgorithm: :concurrentlyは使用せず、標準的なRailsのchangeメソッド内でremove_indexを実行する慣例がある。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-11-17T00:46:30.794Z
Learnt from: tyrrell-IH
Repo: fjordllc/bootcamp PR: 9306
File: app/javascript/components/Bookmarks.jsx:248-265
Timestamp: 2025-11-17T00:46:30.794Z
Learning: fjordllc/bootcamp プロジェクトでは、Reactからバニラ JavaScript への移行作業が進行中である。そのため、新しいReactファイルの作成は避け、既存のReactコンポーネント内で完結する実装が推奨される。BookmarksInDashboard.jsx は issue #9045 で削除予定。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-06-29T03:44:15.179Z
Learnt from: hirokiej
Repo: fjordllc/bootcamp PR: 8740
File: app/helpers/reports_helper.rb:56-64
Timestamp: 2025-06-29T03:44:15.179Z
Learning: このプロジェクト(fjordllc/bootcamp)では、ja.ymlファイルで一部の単語や文章のみI18n対応されているが、多くのテキストは日本語でハードコーディングされており、完全な国際化対応は行われていない。新しい機能でもI18n対応は不要と判断される。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-09-12T21:16:47.639Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-09-12T21:17:45.295Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:52-56
Timestamp: 2025-09-12T21:17:45.295Z
Learning: Rails upgrade PRにおいて、configuration systemの改善提案(shared configuration fallback等)も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-09-01T22:31:57.345Z
Learnt from: matuaya
Repo: fjordllc/bootcamp PR: 9108
File: app/models/after_user_retirement.rb:0-0
Timestamp: 2025-09-01T22:31:57.345Z
Learning: fjordllc/bootcampプロジェクトにおいて、`Newspaper.publish(:retirement_create, { user: user })`はUnfinishedDataDestroyer(未チェックProduct・WIP Report削除、career_pathリセット)とTimesChannelDestroyer(Discord分報チャンネル削除)による重要なデータクリーンアップ処理を実行するため、退会のトリガーが何であろうと(admin、hibernation、user)必ず実行する必要がある。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-09-12T21:17:26.029Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:19-23
Timestamp: 2025-09-12T21:17:26.029Z
Learning: Rails アップグレードPRにおいて、config_for(:secrets) を使った webhook URL 設定の shared セクション未参照問題は、設定システム全体の変更として別PRで対応すべきである。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-08-31T23:39:23.210Z
Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: app/views/pair_works/_body.html.slim:111-117
Timestamp: 2025-08-31T23:39:23.210Z
Learning: PairWorkモデルにreserved_at_in_schedules?カスタムバリデーション(on: :update)が実装されており、reserved_atが必ずschedules.map(&:proposed_at)に含まれることを検証している。これにより、フォームから任意の日時を送信することを防いでいる。

Applied to files:

  • test/system/regular_events/participation_test.rb
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (4)
config/locales/ja.yml (1)

24-26: LGTM!

新しい時間フォーマットが適切に追加されています。day_name フォーマット(%A)は rails-i18n のフル曜日名(日曜日、月曜日など)を返し、default_with_space はビューでの日時表示に使用されています。

app/views/users/form/_learning_time_frames.html.slim (1)

14-15: LGTM!

ハードコードされていた曜日配列を I18n.t('date.abbr_day_names') に置き換えており、PR の目的に沿った変更です。曜日のインデックス(日曜日 = 0)も正しく維持されています。

test/system/regular_events/participation_test.rb (1)

49-49: LGTM!

I18n.l(now, format: :day_name) を使用して動的に曜日名を取得しています。これにより、テストがどの曜日に実行されても正しく動作し、ハードコードされた曜日配列への依存を排除しています。

Also applies to: 59-59

app/components/calendar/nico_nico_calendar_component.html.slim (1)

26-30: LGTM!

I18n.t('date.abbr_day_names') を使用し、each_with_index で曜日ヘッダーを動的に生成しています。日曜日(index 0)と土曜日(index 6)に適切なCSSクラスを付与するロジックも正しく実装されています。

@yokomaru yokomaru force-pushed the chore/use_i18n_to_display_the_days_of_the_week branch 3 times, most recently from e384b10 to d02b80f Compare December 26, 2025 09:00
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
test/system/admin/campaigns_test.rb (1)

136-137: コメントアウトされたコード内のI18n移行について

これらの行は正しくI18n.lを使用するように更新されていますが、大きなテストブロック(119-171行目)全体がコメントアウトされているため、実際のテスト実行には影響しません。

コメントアウトされたコードを保守し続けるのは一般的に推奨されません。このテストを:

  • 近い将来有効化する予定がある場合:そのままで問題ありません
  • 削除すべき場合:コメントアウトされたコード全体を削除することを検討してください
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e384b10 and d02b80f.

📒 Files selected for processing (18)
  • app/components/calendar/nico_nico_calendar_component.html.slim
  • app/controllers/users/activity_times_controller.rb
  • app/decorators/regular_event_decorator.rb
  • app/helpers/activity_times_helper.rb
  • app/helpers/users_helper.rb
  • app/models/regular_event.rb
  • app/notifiers/discord_notifier.rb
  • app/views/companies/products/_product.html.slim
  • app/views/regular_events/_regular_event_repeat_rule_fields.html.slim
  • app/views/users/_learning_time_frames.html.slim
  • app/views/users/activity_times/_activity_time_tabs.html.slim
  • app/views/users/activity_times/index.html.slim
  • app/views/users/form/_learning_time_frames.html.slim
  • config/locales/ja.yml
  • test/helpers/activity_times_helper_test.rb
  • test/system/admin/campaigns_test.rb
  • test/system/mentor/survey_questions_test.rb
  • test/system/regular_events/participation_test.rb
💤 Files with no reviewable changes (4)
  • app/models/regular_event.rb
  • test/helpers/activity_times_helper_test.rb
  • app/helpers/activity_times_helper.rb
  • app/helpers/users_helper.rb
🚧 Files skipped from review as they are similar to previous changes (11)
  • app/views/users/_learning_time_frames.html.slim
  • test/system/mentor/survey_questions_test.rb
  • test/system/regular_events/participation_test.rb
  • app/views/users/activity_times/index.html.slim
  • app/views/users/form/_learning_time_frames.html.slim
  • app/decorators/regular_event_decorator.rb
  • app/controllers/users/activity_times_controller.rb
  • app/notifiers/discord_notifier.rb
  • config/locales/ja.yml
  • app/components/calendar/nico_nico_calendar_component.html.slim
  • app/views/users/activity_times/_activity_time_tabs.html.slim
🧰 Additional context used
📓 Path-based instructions (5)
**/*.slim

📄 CodeRabbit inference engine (AGENTS.md)

Slim templates should be linted according to config/slim_lint.yml

Files:

  • app/views/regular_events/_regular_event_repeat_rule_fields.html.slim
  • app/views/companies/products/_product.html.slim
test/**/*_test.rb

📄 CodeRabbit inference engine (AGENTS.md)

test/**/*_test.rb: Test suite should use Minitest with structure: system/, models/, controllers/, and fixtures in test/fixtures/; test files should be named *_test.rb
Use Minitest + Capybara for system tests; place unit and integration tests under matching test/* directories

Files:

  • test/system/admin/campaigns_test.rb
**/*.rb

📄 CodeRabbit inference engine (AGENTS.md)

Ruby code should use 2-space indentation, snake_case for method names, and CamelCase for class names, enforced by RuboCop (.rubocop.yml)

Files:

  • test/system/admin/campaigns_test.rb

⚙️ CodeRabbit configuration file

**/*.rb: # refactoring

  • まずFat Controllerを避け、次にFat Modelを避ける。
  • Serviceクラスの乱用を避ける。
  • controller concernを作ろうとしたらPORO(Plain Old Ruby Object)やActiveRecordモデルでの実装で代替できないか検討する。

Rails Patterns

  • ViewHelperにメソッドを実装する時にはまずDecoratorパターンを使うことを検討する。(active_decorator gemを導入しているのでそれを使う)
  • 複雑なActiveRecordクエリがあり、再利用できそうな場合はQueryObjectパターンを検討する。(rails-patterns gemを導入しているのでそれのQuery機能を使う)
  • Viewにpartialを作る場合はViewComponentを使うことを検討する。
  • 複数のActiveRecordモデルを操作する1つの責務がある時や外部APIとやりとりする処理がある場合にはInteractorオブジェクトパターンを検討する。(interactor gemを導入しているのでそれを使う)
  • 複数のInteractorを実行するような処理がある場合Organizerオブジェクトパターンを検討する。(interactor gemを導入しており、その中にOrganizerの機能があるので使う)

Files:

  • test/system/admin/campaigns_test.rb
test/**

📄 CodeRabbit inference engine (AGENTS.md)

Keep tests deterministic and use fixtures stored in test/fixtures/ for test data

Files:

  • test/system/admin/campaigns_test.rb
test/**/*

⚙️ CodeRabbit configuration file

test/**/*: # Test

  • TestCase名は英語で書く。
  • どうしても避けられない時以外にsystem testでsleepは使わない。

Unit Test

model, helper, decorator, view_componentについてはメソッドを追加した場合は必ず対応したUnit TestのTestCaseを1つは書く。

Files:

  • test/system/admin/campaigns_test.rb
🧠 Learnings (13)
📓 Common learnings
Learnt from: hirokiej
Repo: fjordllc/bootcamp PR: 8740
File: app/helpers/reports_helper.rb:56-64
Timestamp: 2025-06-29T03:44:15.179Z
Learning: このプロジェクト(fjordllc/bootcamp)では、ja.ymlファイルで一部の単語や文章のみI18n対応されているが、多くのテキストは日本語でハードコーディングされており、完全な国際化対応は行われていない。新しい機能でもI18n対応は不要と判断される。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: app/controllers/mentor/buzzes_controller.rb:0-0
Timestamp: 2025-09-04T01:39:22.261Z
Learning: fjordllc/bootcamp プロジェクトでは、更新処理の成功時の通知メッセージについて、I18n を使用せずに日本語文字列を直接記述する方針で一貫性を保っている。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。
Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 0
File: :0-0
Timestamp: 2025-07-23T20:42:19.974Z
Learning: fjordllc/bootcampプロジェクトでは、hタグ(見出し)の文言は日本語でハードコーディングする方針が確立されており、I18n対応は行わない。例:app/views/welcome/logo.html.slimでh2、h3タグが日本語でハードコーディングされている。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:52-56
Timestamp: 2025-09-12T21:17:45.295Z
Learning: Rails upgrade PRにおいて、configuration systemの改善提案(shared configuration fallback等)も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/product.rb:59-61
Timestamp: 2025-09-11T14:47:53.256Z
Learning: Rails アップグレードPRでは、アップグレードに直接関連しない性能改善や機能追加の提案は避けるべき。PRのスコープを維持することが重要で、そのような改善提案は別PRで対応すべきである。
📚 Learning: 2025-08-31T23:39:23.210Z
Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: app/views/pair_works/_body.html.slim:111-117
Timestamp: 2025-08-31T23:39:23.210Z
Learning: PairWorkモデルにreserved_at_in_schedules?カスタムバリデーション(on: :update)が実装されており、reserved_atが必ずschedules.map(&:proposed_at)に含まれることを検証している。これにより、フォームから任意の日時を送信することを防いでいる。

Applied to files:

  • app/views/regular_events/_regular_event_repeat_rule_fields.html.slim
📚 Learning: 2025-11-26T08:23:30.927Z
Learnt from: CR
Repo: fjordllc/bootcamp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T08:23:30.927Z
Learning: Applies to test/**/*_test.rb : Use Minitest + Capybara for system tests; place unit and integration tests under matching `test/*` directories

Applied to files:

  • test/system/admin/campaigns_test.rb
📚 Learning: 2025-09-12T21:18:00.834Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-09-04T01:39:22.261Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: app/controllers/mentor/buzzes_controller.rb:0-0
Timestamp: 2025-09-04T01:39:22.261Z
Learning: fjordllc/bootcamp プロジェクトでは、更新処理の成功時の通知メッセージについて、I18n を使用せずに日本語文字列を直接記述する方針で一貫性を保っている。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-11-13T09:20:36.030Z
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 9115
File: db/migrate/20250902024949_add_unique_index_to_correct_answers.rb:1-5
Timestamp: 2025-11-13T09:20:36.030Z
Learning: fjordllc/bootcamp プロジェクトでは、データの整合性を保つためのデータ修正には data-migrate gem を使用し、db/data/ ディレクトリ配下にデータマイグレーションファイルを作成する運用を採用している。スキーマ変更(db/migrate/)とデータ変更(db/data/)を分離することで、より安全で管理しやすい構成を実現している。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-09-04T01:50:47.773Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: db/migrate/20250831234516_remove_unique_index_from_buzzes_title.rb:1-5
Timestamp: 2025-09-04T01:50:47.773Z
Learning: fjordllc/bootcampプロジェクトでは、マイグレーションにおいてdisable_ddl_transaction!やalgorithm: :concurrentlyは使用せず、標準的なRailsのchangeメソッド内でremove_indexを実行する慣例がある。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-11-17T00:46:30.794Z
Learnt from: tyrrell-IH
Repo: fjordllc/bootcamp PR: 9306
File: app/javascript/components/Bookmarks.jsx:248-265
Timestamp: 2025-11-17T00:46:30.794Z
Learning: fjordllc/bootcamp プロジェクトでは、Reactからバニラ JavaScript への移行作業が進行中である。そのため、新しいReactファイルの作成は避け、既存のReactコンポーネント内で完結する実装が推奨される。BookmarksInDashboard.jsx は issue #9045 で削除予定。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-06-29T03:44:15.179Z
Learnt from: hirokiej
Repo: fjordllc/bootcamp PR: 8740
File: app/helpers/reports_helper.rb:56-64
Timestamp: 2025-06-29T03:44:15.179Z
Learning: このプロジェクト(fjordllc/bootcamp)では、ja.ymlファイルで一部の単語や文章のみI18n対応されているが、多くのテキストは日本語でハードコーディングされており、完全な国際化対応は行われていない。新しい機能でもI18n対応は不要と判断される。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-09-12T21:16:47.639Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-09-12T21:17:45.295Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:52-56
Timestamp: 2025-09-12T21:17:45.295Z
Learning: Rails upgrade PRにおいて、configuration systemの改善提案(shared configuration fallback等)も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-09-01T22:31:57.345Z
Learnt from: matuaya
Repo: fjordllc/bootcamp PR: 9108
File: app/models/after_user_retirement.rb:0-0
Timestamp: 2025-09-01T22:31:57.345Z
Learning: fjordllc/bootcampプロジェクトにおいて、`Newspaper.publish(:retirement_create, { user: user })`はUnfinishedDataDestroyer(未チェックProduct・WIP Report削除、career_pathリセット)とTimesChannelDestroyer(Discord分報チャンネル削除)による重要なデータクリーンアップ処理を実行するため、退会のトリガーが何であろうと(admin、hibernation、user)必ず実行する必要がある。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-09-12T21:17:26.029Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:19-23
Timestamp: 2025-09-12T21:17:26.029Z
Learning: Rails アップグレードPRにおいて、config_for(:secrets) を使った webhook URL 設定の shared セクション未参照問題は、設定システム全体の変更として別PRで対応すべきである。

Applied to files:

  • app/views/companies/products/_product.html.slim
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (3)
app/views/companies/products/_product.html.slim (2)

62-77: LGTM! コメント日時の表示も統一されています。

最終コメント日時(提出者・メンター)の表示も同様に I18n ベースのフォーマットに移行されており、一貫性が保たれています。条件分岐のロジックは維持されたまま、日時表示のみが改善されています。


29-39: I18nベースの日付フォーマット化が適切に実装されています。

提出日時、作成日時、更新日時の表示を統一して l ヘルパーと :default_with_space フォーマットで処理する変更は、コードの保守性を向上させています。:default_with_space フォーマットには曜日情報が含まれており、表示される日付は「2025年 3月 15日 (土) 14:30」のような形式になります。

app/views/regular_events/_regular_event_repeat_rule_fields.html.slim (1)

16-16: weekday_options_for_select ヘルパーメソッドが実装されていません。

Line 16 で呼び出されている weekday_options_for_select ヘルパーメソッドがコードベースに存在しません。このままではテンプレートが NoMethodError で失敗します。ヘルパーメソッドの実装が必要です。

⛔ Skipped due to learnings
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。
Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: app/views/pair_works/_body.html.slim:111-117
Timestamp: 2025-08-31T23:39:23.210Z
Learning: PairWorkモデルにreserved_at_in_schedules?カスタムバリデーション(on: :update)が実装されており、reserved_atが必ずschedules.map(&:proposed_at)に含まれることを検証している。これにより、フォームから任意の日時を送信することを防いでいる。
Learnt from: tyrrell-IH
Repo: fjordllc/bootcamp PR: 8807
File: app/views/welcome/job_support.html.slim:391-392
Timestamp: 2025-06-21T22:30:20.116Z
Learning: このプロジェクトにはRailsの組み込みmarkdownヘルパが利用できないため、markdownのHTML変換には自前でヘルパを実装する必要がある。

@yokomaru yokomaru force-pushed the chore/use_i18n_to_display_the_days_of_the_week branch from 20d48e7 to 419ec48 Compare January 10, 2026 16:22
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
test/system/regular_events/participation_test.rb (1)

47-47: テスト間の一貫性について

このテストは現在の曜日を動的に使用するよう変更されましたが、最初のテストケース(Line 20)では依然として '月曜日' がハードコードされています。すべてのテストケースで同じアプローチを使用することで、保守性が向上します。

♻️ 一貫性のための提案

最初のテストケースも同様に動的な曜日選択に変更することを検討してください:

test 'create a regular event for all students and trainees' do
  now = Time.current
  visit_with_auth new_regular_event_path, 'komagata'
  within 'form[name=regular_event]' do
    fill_in 'regular_event[title]', with: '全員参加イベント'
    first('.choices__inner').click
    find('#choices--js-choices-multiple-select-item-choice-1').click
    first('.regular-event-repeat-rule').first('.regular-event-repeat-rule__frequency select').select('毎週')
    first('.regular-event-repeat-rule').first('.regular-event-repeat-rule__day-of-the-week select').select(I18n.l(now, format: :day_name))
    # ... rest of test
  end
  click_button '作成'
  assert_text '定期イベントを作成しました。'
  assert_text "毎週#{I18n.l(now, format: :day_name)}"
  # ...
end

Also applies to: 55-55

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 20d48e7 and 419ec48.

📒 Files selected for processing (18)
  • app/components/calendar/nico_nico_calendar_component.html.slim
  • app/controllers/users/activity_times_controller.rb
  • app/decorators/regular_event_decorator.rb
  • app/helpers/activity_times_helper.rb
  • app/helpers/users_helper.rb
  • app/models/regular_event.rb
  • app/notifiers/discord_notifier.rb
  • app/views/companies/products/_product.html.slim
  • app/views/regular_events/_regular_event_repeat_rule_fields.html.slim
  • app/views/users/_learning_time_frames.html.slim
  • app/views/users/activity_times/_activity_time_tabs.html.slim
  • app/views/users/activity_times/index.html.slim
  • app/views/users/form/_learning_time_frames.html.slim
  • config/locales/ja.yml
  • test/helpers/activity_times_helper_test.rb
  • test/system/admin/campaigns_test.rb
  • test/system/mentor/survey_questions_test.rb
  • test/system/regular_events/participation_test.rb
💤 Files with no reviewable changes (4)
  • app/helpers/users_helper.rb
  • app/models/regular_event.rb
  • app/helpers/activity_times_helper.rb
  • test/helpers/activity_times_helper_test.rb
🚧 Files skipped from review as they are similar to previous changes (4)
  • test/system/admin/campaigns_test.rb
  • app/views/users/form/_learning_time_frames.html.slim
  • config/locales/ja.yml
  • app/components/calendar/nico_nico_calendar_component.html.slim
🧰 Additional context used
📓 Path-based instructions (6)
app/views/**/*.slim

📄 CodeRabbit inference engine (AGENTS.md)

Place Slim templates in app/views/ and ensure they are linted according to config/slim_lint.yml

Files:

  • app/views/companies/products/_product.html.slim
  • app/views/regular_events/_regular_event_repeat_rule_fields.html.slim
  • app/views/users/activity_times/index.html.slim
  • app/views/users/activity_times/_activity_time_tabs.html.slim
  • app/views/users/_learning_time_frames.html.slim
app/**/*.rb

📄 CodeRabbit inference engine (AGENTS.md)

app/**/*.rb: Place Rails app code in app/ directory with subdirectories for models/, controllers/, views/, jobs/, helpers/, and frontend code under javascript/
Follow Rails file naming conventions (e.g., app/models/user.rb)

Files:

  • app/decorators/regular_event_decorator.rb
  • app/notifiers/discord_notifier.rb
  • app/controllers/users/activity_times_controller.rb
**/*.rb

📄 CodeRabbit inference engine (AGENTS.md)

Use 2-space indent for Ruby code, snake_case for method names, and CamelCase for class names as enforced by RuboCop

Files:

  • app/decorators/regular_event_decorator.rb
  • test/system/mentor/survey_questions_test.rb
  • app/notifiers/discord_notifier.rb
  • test/system/regular_events/participation_test.rb
  • app/controllers/users/activity_times_controller.rb

⚙️ CodeRabbit configuration file

**/*.rb: # refactoring

  • まずFat Controllerを避け、次にFat Modelを避ける。
  • Serviceクラスの乱用を避ける。
  • controller concernを作ろうとしたらPORO(Plain Old Ruby Object)やActiveRecordモデルでの実装で代替できないか検討する。

Rails Patterns

  • ViewHelperにメソッドを実装する時にはまずDecoratorパターンを使うことを検討する。(active_decorator gemを導入しているのでそれを使う)
  • 複雑なActiveRecordクエリがあり、再利用できそうな場合はQueryObjectパターンを検討する。(rails-patterns gemを導入しているのでそれのQuery機能を使う)
  • Viewにpartialを作る場合はViewComponentを使うことを検討する。
  • 複数のActiveRecordモデルを操作する1つの責務がある時や外部APIとやりとりする処理がある場合にはInteractorオブジェクトパターンを検討する。(interactor gemを導入しているのでそれを使う)
  • 複数のInteractorを実行するような処理がある場合Organizerオブジェクトパターンを検討する。(interactor gemを導入しており、その中にOrganizerの機能があるので使う)

Files:

  • app/decorators/regular_event_decorator.rb
  • test/system/mentor/survey_questions_test.rb
  • app/notifiers/discord_notifier.rb
  • test/system/regular_events/participation_test.rb
  • app/controllers/users/activity_times_controller.rb
test/**/*_test.rb

📄 CodeRabbit inference engine (AGENTS.md)

Place unit and integration tests under matching test/* directories with *_test.rb naming convention

Files:

  • test/system/mentor/survey_questions_test.rb
  • test/system/regular_events/participation_test.rb
test/system/**/*_test.rb

📄 CodeRabbit inference engine (AGENTS.md)

Use Minitest + Capybara for system tests; place system tests in test/system/ directory

Files:

  • test/system/mentor/survey_questions_test.rb
  • test/system/regular_events/participation_test.rb
test/**/*

⚙️ CodeRabbit configuration file

test/**/*: # Test

  • TestCase名は英語で書く。
  • どうしても避けられない時以外にsystem testでsleepは使わない。

Unit Test

model, helper, decorator, view_componentについてはメソッドを追加した場合は必ず対応したUnit TestのTestCaseを1つは書く。

Files:

  • test/system/mentor/survey_questions_test.rb
  • test/system/regular_events/participation_test.rb
🧠 Learnings (13)
📓 Common learnings
Learnt from: hirokiej
Repo: fjordllc/bootcamp PR: 8740
File: app/helpers/reports_helper.rb:56-64
Timestamp: 2025-06-29T03:44:15.179Z
Learning: このプロジェクト(fjordllc/bootcamp)では、ja.ymlファイルで一部の単語や文章のみI18n対応されているが、多くのテキストは日本語でハードコーディングされており、完全な国際化対応は行われていない。新しい機能でもI18n対応は不要と判断される。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: app/controllers/mentor/buzzes_controller.rb:0-0
Timestamp: 2025-09-04T01:39:22.261Z
Learning: fjordllc/bootcamp プロジェクトでは、更新処理の成功時の通知メッセージについて、I18n を使用せずに日本語文字列を直接記述する方針で一貫性を保っている。
Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 0
File: :0-0
Timestamp: 2025-07-23T20:42:19.974Z
Learning: fjordllc/bootcampプロジェクトでは、hタグ(見出し)の文言は日本語でハードコーディングする方針が確立されており、I18n対応は行わない。例:app/views/welcome/logo.html.slimでh2、h3タグが日本語でハードコーディングされている。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:52-56
Timestamp: 2025-09-12T21:17:45.295Z
Learning: Rails upgrade PRにおいて、configuration systemの改善提案(shared configuration fallback等)も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/product.rb:59-61
Timestamp: 2025-09-11T14:47:53.256Z
Learning: Rails アップグレードPRでは、アップグレードに直接関連しない性能改善や機能追加の提案は避けるべき。PRのスコープを維持することが重要で、そのような改善提案は別PRで対応すべきである。
📚 Learning: 2025-09-12T21:18:00.834Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。

Applied to files:

  • app/views/companies/products/_product.html.slim
  • app/views/users/activity_times/index.html.slim
📚 Learning: 2025-09-04T01:39:22.261Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: app/controllers/mentor/buzzes_controller.rb:0-0
Timestamp: 2025-09-04T01:39:22.261Z
Learning: fjordllc/bootcamp プロジェクトでは、更新処理の成功時の通知メッセージについて、I18n を使用せずに日本語文字列を直接記述する方針で一貫性を保っている。

Applied to files:

  • app/views/companies/products/_product.html.slim
  • app/views/users/activity_times/index.html.slim
📚 Learning: 2025-11-13T09:20:36.030Z
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 9115
File: db/migrate/20250902024949_add_unique_index_to_correct_answers.rb:1-5
Timestamp: 2025-11-13T09:20:36.030Z
Learning: fjordllc/bootcamp プロジェクトでは、データの整合性を保つためのデータ修正には data-migrate gem を使用し、db/data/ ディレクトリ配下にデータマイグレーションファイルを作成する運用を採用している。スキーマ変更(db/migrate/)とデータ変更(db/data/)を分離することで、より安全で管理しやすい構成を実現している。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-09-04T01:50:47.773Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: db/migrate/20250831234516_remove_unique_index_from_buzzes_title.rb:1-5
Timestamp: 2025-09-04T01:50:47.773Z
Learning: fjordllc/bootcampプロジェクトでは、マイグレーションにおいてdisable_ddl_transaction!やalgorithm: :concurrentlyは使用せず、標準的なRailsのchangeメソッド内でremove_indexを実行する慣例がある。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-11-17T00:46:30.794Z
Learnt from: tyrrell-IH
Repo: fjordllc/bootcamp PR: 9306
File: app/javascript/components/Bookmarks.jsx:248-265
Timestamp: 2025-11-17T00:46:30.794Z
Learning: fjordllc/bootcamp プロジェクトでは、Reactからバニラ JavaScript への移行作業が進行中である。そのため、新しいReactファイルの作成は避け、既存のReactコンポーネント内で完結する実装が推奨される。BookmarksInDashboard.jsx は issue #9045 で削除予定。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-06-29T03:44:15.179Z
Learnt from: hirokiej
Repo: fjordllc/bootcamp PR: 8740
File: app/helpers/reports_helper.rb:56-64
Timestamp: 2025-06-29T03:44:15.179Z
Learning: このプロジェクト(fjordllc/bootcamp)では、ja.ymlファイルで一部の単語や文章のみI18n対応されているが、多くのテキストは日本語でハードコーディングされており、完全な国際化対応は行われていない。新しい機能でもI18n対応は不要と判断される。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-09-12T21:16:47.639Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。

Applied to files:

  • app/views/companies/products/_product.html.slim
  • app/views/users/activity_times/index.html.slim
📚 Learning: 2025-09-12T21:17:45.295Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:52-56
Timestamp: 2025-09-12T21:17:45.295Z
Learning: Rails upgrade PRにおいて、configuration systemの改善提案(shared configuration fallback等)も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-09-01T22:31:57.345Z
Learnt from: matuaya
Repo: fjordllc/bootcamp PR: 9108
File: app/models/after_user_retirement.rb:0-0
Timestamp: 2025-09-01T22:31:57.345Z
Learning: fjordllc/bootcampプロジェクトにおいて、`Newspaper.publish(:retirement_create, { user: user })`はUnfinishedDataDestroyer(未チェックProduct・WIP Report削除、career_pathリセット)とTimesChannelDestroyer(Discord分報チャンネル削除)による重要なデータクリーンアップ処理を実行するため、退会のトリガーが何であろうと(admin、hibernation、user)必ず実行する必要がある。

Applied to files:

  • app/views/companies/products/_product.html.slim
  • app/views/users/activity_times/index.html.slim
📚 Learning: 2025-09-12T21:17:26.029Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:19-23
Timestamp: 2025-09-12T21:17:26.029Z
Learning: Rails アップグレードPRにおいて、config_for(:secrets) を使った webhook URL 設定の shared セクション未参照問題は、設定システム全体の変更として別PRで対応すべきである。

Applied to files:

  • app/views/companies/products/_product.html.slim
📚 Learning: 2025-08-31T23:39:23.210Z
Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: app/views/pair_works/_body.html.slim:111-117
Timestamp: 2025-08-31T23:39:23.210Z
Learning: PairWorkモデルにreserved_at_in_schedules?カスタムバリデーション(on: :update)が実装されており、reserved_atが必ずschedules.map(&:proposed_at)に含まれることを検証している。これにより、フォームから任意の日時を送信することを防いでいる。

Applied to files:

  • app/views/regular_events/_regular_event_repeat_rule_fields.html.slim
  • test/system/regular_events/participation_test.rb
📚 Learning: 2026-01-08T21:12:18.350Z
Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: app/controllers/pair_works_controller.rb:10-18
Timestamp: 2026-01-08T21:12:18.350Z
Learning: In fjordllc/bootcamp, when using ActiveRecord.order to specify ascending order, omit the explicit :asc and rely on Rails' default ASC behavior. Prefer .order(:published_at) over .order(published_at: :asc). If you need a non-default order (e.g., DESC), specify it explicitly. This guideline applies to Ruby/Rails controller and model files, especially in app/controllers and similar ActiveRecord usage sites.

Applied to files:

  • app/controllers/users/activity_times_controller.rb
🧬 Code graph analysis (1)
test/system/mentor/survey_questions_test.rb (1)
test/system/admin/campaigns_test.rb (1)
  • current (5-192)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (10)
app/decorators/regular_event_decorator.rb (1)

7-7: コードの簡潔化が適切です

以前の DAY_OF_THE_WEEK_LIST.find による検索から、I18n による直接的な配列インデックスアクセスに変更されており、コードが大幅に簡潔になっています。Rails の標準的な I18n の使用方法に従っており、適切な変更です。

app/views/regular_events/_regular_event_repeat_rule_fields.html.slim (1)

16-16: Rails 標準ヘルパーの使用で適切です

weekday_options_for_select ヘルパーの使用により、カスタム定数 DAY_OF_THE_WEEK_LIST への依存がなくなり、Rails の標準的な方法で曜日選択が実装されています。beginning_of_week: :sunday および index_as_value: true のパラメータは、元の動作(日曜日=0から始まるインデックス値)を正しく再現しています。

app/views/users/_learning_time_frames.html.slim (1)

10-11: I18n による曜日表示への移行が適切です

ローカル変数またはヘルパーメソッドから I18n.t('date.abbr_day_names') への変更により、曜日の略称表示が統一的に I18n から取得されるようになりました。この変更は、プロジェクト全体の I18n への移行方針と一致しています。

app/notifiers/discord_notifier.rb (1)

69-69: Discord 通知メッセージのフォーマットを確認してください

:mdw ロケールフォーマットは '%m/%d %a' として定義されており、実際の出力は "05/05 金" のような形式になります(ゼロパディング付きの月日と空白区切り)。レビューで述べられている "12/3(月)" という形式(括弧付き、パディングなし)が意図している場合は、:mdw_unique フォーマット('%-m/%-d(%a)')の使用を検討してください。

Likely an incorrect or invalid review comment.

app/views/companies/products/_product.html.slim (2)

29-29: 提出日時のフォーマットをI18n化

複雑な日付コンポーネントの抽出と曜日配列の参照から、シンプルな l ヘルパーへの置き換えが適切に行われています。コードが大幅に簡潔になり、保守性が向上しています。

Also applies to: 34-34, 39-39


62-62: コメントタイムスタンプのフォーマットをI18n化

最終コメント日時の表示も同様にI18nベースのフォーマットに統一されており、一貫性が保たれています。

Also applies to: 67-67, 72-72, 77-77

app/views/users/activity_times/index.html.slim (1)

25-25: ページタイトルの曜日表示をI18n化

ローカル変数からI18nへの置き換えが適切に行われています。I18n.t('date.day_names') は完全な曜日名(「日曜日」「月曜日」など)の配列を返し、ページタイトルの表示に使用されています。

app/views/users/activity_times/_activity_time_tabs.html.slim (1)

8-8: ドロップダウンの曜日表示をI18n化

活動時間フィルターのドロップダウンにおいて、ハードコードされた曜日配列からI18nベースの表示に統一されています。選択中の曜日表示とドロップダウンオプションの両方で一貫してI18nを使用しており、適切な実装です。

Also applies to: 11-11

test/system/mentor/survey_questions_test.rb (1)

13-14: テストの日付フォーマットをI18n化

複雑な strftime 呼び出しから I18n.l(Time.current, format: :long) へのシンプルな置き換えが行われており、テストの可読性が向上しています。:long フォーマットは config/locales/ja.yml'%Y年%m月%d日(%a)' として定義されており、日本語日付文字列(例:2025年1月15日(水))を正しく生成します。

app/controllers/users/activity_times_controller.rb (1)

32-32: I18n を使用した曜日名の取得に統一

I18n.t('date.abbr_day_names')[day_of_week.to_i] による実装は適切です。rails-i18n によって提供される標準キーであり、返される配列(['日', '月', '火', '水', '木', '金', '土'])は learning_time_frames.week_day カラムが期待する値と一致しており、インデックス構造(0 始まり、日曜日から)も正しく対応しています。コードベース全体で同じパターンが使用されており(LearningTimeFrame モデル、TimeRangeHelper、複数のビュー)、一貫性があります。

Comment on lines -30 to +29
| #{product.published_at.year}年
#{product.published_at.mon}月
#{product.published_at.day}日
(#{day_of_the_week[product.published_at.wday]})
#{product.published_at.strftime('%R')}
| #{l product.published_at}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

企業別提出物ページの日付表示が、他の提出物ページ(http://localhost:3000/products) と異なり年や月の間にスペースが入っていました。町田さんに確認したところ意図しない表示(既存不具合)のようだったのでスペースが入らないように修正しています。

修正前

スクリーンショット 2026-01-11 2 46 55

修正後
スクリーンショット 2026-01-11 2 35 33

# campaign_start = start_at.strftime("%-m/%-d(#{WEEK_DAY[start_at.wday]})")
# campaign_end = end_at.strftime("%-m/%-d(#{WEEK_DAY[end_at.wday]})")
# campaign_start = I18n.l(start_at, format: :mdw_unique)
# campaign_end = I18n.l(end_at, format: :mdw_unique)
Copy link
Contributor Author

@yokomaru yokomaru Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

キャンペーンページのシステムテストは、ケースが細かすぎて失敗しやすくなっているため現在は一旦コメントアウトされているとのことでした(質問タイムで確認済み)。
今後不要なケースを削除したうえで復活させる予定とのことなので、コメントアウト内の曜日配列についても併せて対応しています。
念のため修正前後で文字列の値が変わっていないことは以下rails cで実行して確認しています。

 WEEK_DAY = %w[      ].freeze
 start_at = Campaign.recently_campaign.first
 end_at = Campaign.recently_campaign.last
 before_campaign_start = start_at.strftime("%-m/%-d(#{WEEK_DAY[start_at.wday]})")
 before_campaign_end = end_at.strftime("%-m/%-d(#{WEEK_DAY[end_at.wday]})")
 campaign_start = I18n.l(start_at, format: :mdw_unique)
 campaign_end = I18n.l(end_at, format: :mdw_unique)
 before_campaign_start == campaign_start
 #=> true
 before_campaign_end == campaign_end
 #=> true

@yokomaru yokomaru requested a review from tyrrell-IH January 11, 2026 02:30
@yokomaru
Copy link
Contributor Author

@tyrrell-IH
お疲れ様です!
こちらのPRにつきまして、レビューをお願いできますでしょうか?🙏(他のPRのレビューがないかも確認した上で依頼させていただいているのですが、見落としていたら申し訳ありません🙇‍♀️)
急ぎではなくいつでも大丈夫ですので、ご検討いただけると幸いです。

@tyrrell-IH
Copy link
Contributor

@yokomaru
レビュー承知しました!
1週間くらいで対応できると思いますが、一旦期限を10日以内(1/21期限)として対応させていただきたいです🙏
遅くなるようであればまたご連絡します〜

@yokomaru
Copy link
Contributor Author

@tyrrell-IH

引き受けてくださりありがとうございます!

1週間くらいで対応できると思いますが、一旦期限を10日以内(1/21期限)として対応させていただきたいです🙏

上記承知いたしました〜!よろしくお願いします。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants