Skip to content

開発環境において休会中ユーザーのプロフィールに休会情報が表示されないバグを修正#9712

Merged
komagata merged 2 commits intomainfrom
bug/inconsistent-seed-data
Mar 18, 2026
Merged

開発環境において休会中ユーザーのプロフィールに休会情報が表示されないバグを修正#9712
komagata merged 2 commits intomainfrom
bug/inconsistent-seed-data

Conversation

@s-tone-gs
Copy link
Copy Markdown
Contributor

@s-tone-gs s-tone-gs commented Mar 2, 2026

Issue

概要

休会情報を持たない休会中ユーザーという矛盾したシードデータが存在していたため、開発環境において休会中ユーザーのプロフィールに休会情報が表示されないバグが発生していた。

変更確認方法

  1. bug/inconsistent-seed-dataをローカルに取り込む
  2. bug/inconsistent-seed-dataを作業ブランチにした状態で以下のコマンドを実行
    rails db:reset ※開発環境のデータが全て削除されるので注意してください
  3. 開発サーバーを起動
  4. 管理者でログイン
  • komagata
  • testtest
  1. http://localhost:3000/users?target=hibernated にアクセス
  2. kyuukai以外のユーザーのプロフィールを開く(以下プロフィールリンク)
  1. 休会情報の欄に以下の項目があることを確認する
  • 1回目の休会
    • 復帰予定日
    • 休会理由
  1. kyuukai以外のユーザーのプロフィール全てを確認するまで手順6~7を繰り返す。

Screenshot

変更前

551878797-7e9294bc-c0ed-4711-af28-219071b505c5

変更後

シードデータ変更後

Summary by CodeRabbit

  • Chores
    • テスト/開発用のハイバネーション(非稼働)データを複数追加しました(開発・検証向けのダミーエントリを追加)。
  • 影響
    • エンドユーザーが直接目にする変更や動作への影響はありません。

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 2, 2026

📝 Walkthrough

Walkthrough

db/fixtures/hibernations.yml に hibernation3〜hibernation9 の7件のハイバネーションフィクスチャを追加。各エントリはユーザー、scheduled_return_on(Time.current + 30.days)、reason、created_at(Time.current に対するオフセット)を含む。既存エントリは変更していない。

Changes

Cohort / File(s) Summary
Hibernation Fixtures
db/fixtures/hibernations.yml
hibernation3hibernation9 の7件を追加。各エントリは異なる usercreated_at の相対オフセットを持ち、すべて scheduled_return_on: <%= Time.current + 30.days %> を使用。既存エントリは削除・変更なし。

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

  • Issue #9670: 開発用のハイバネーションデータ不足に対処するため、hibernation シードを追加して返却日と理由を供給している点で関連。

Poem

🐰 ぼくはうさぎ、フィクスチャ蒔くよ、
七つの眠り、春へとつなぐ、
三十日待てばみんな目を覚まし、
理由も刻まれテストは踊る、
ふわふわデータ、跳ねて喜ぶ。

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed タイトルは、開発環境の休会中ユーザープロフィールに休会情報が表示されないバグ修正という主要な変更内容を正確に反映しており、具体的で理解しやすい。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed プルリクエストの説明が指定されたテンプレートの全ての必須セクション(Issue、概要、変更確認方法、Screenshot)を含み、詳細かつ適切に記載されている。

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bug/inconsistent-seed-data

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

@s-tone-gs s-tone-gs force-pushed the bug/inconsistent-seed-data branch from 36134c8 to d8427ad Compare March 2, 2026 02:50
@s-tone-gs s-tone-gs marked this pull request as ready for review March 2, 2026 05:57
@github-actions github-actions bot requested a review from komagata March 2, 2026 05:57
Copy link
Copy Markdown

@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.

🧹 Nitpick comments (1)
db/fixtures/hibernations.yml (1)

31-31: .hour.hours に統一してください。

プロジェクト方針として、時間の加算には Numeric#hours(複数形)を優先して使用しています。line 31 の .hour.hours に統一することで、保守性と一貫性が向上します。

差分案
-  created_at: <%= Time.current - 3.months + 23.hour %>
+  created_at: <%= Time.current - 3.months + 23.hours %>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@db/fixtures/hibernations.yml` at line 31, 行31の created_at の日時式 "Time.current
- 3.months + 23.hour" で単数形の .hour を使っていますが、プロジェクト方針に従い
Numeric#hours(複数形)に統一してください;具体的には該当式を "Time.current - 3.months + 23.hours"
に置き換えてテスト/fixture の動作に問題がないか確認してください。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@db/fixtures/hibernations.yml`:
- Line 31: 行31の created_at の日時式 "Time.current - 3.months + 23.hour" で単数形の .hour
を使っていますが、プロジェクト方針に従い Numeric#hours(複数形)に統一してください;具体的には該当式を "Time.current -
3.months + 23.hours" に置き換えてテスト/fixture の動作に問題がないか確認してください。

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cc8bb98 and d8427ad.

📒 Files selected for processing (1)
  • db/fixtures/hibernations.yml

@s-tone-gs s-tone-gs requested a review from matuaya March 2, 2026 06:06
@s-tone-gs
Copy link
Copy Markdown
Contributor Author

s-tone-gs commented Mar 2, 2026

@matuaya
お疲れ様です!レビュー依頼させていただきました!
こちら動作確認でrails db:resetを行う必要があり、一度開発環境のデータがすべて削除されてしまうので、修正が落ち着いたタイミングなどキリの良い場面でご確認いただければと思います。
急ぎではありませんのでよろしくお願いいたします。1週間以上かかりそうな場合は別の人に依頼しますので教えていただけると幸いです🙇‍♂️🙇‍♂️

休会情報を持たない休会中ユーザーが存在していたため
新しい休会情報を作成した
@s-tone-gs s-tone-gs force-pushed the bug/inconsistent-seed-data branch from d8427ad to 620dfeb Compare March 2, 2026 06:27
Copy link
Copy Markdown

@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.

🧹 Nitpick comments (1)
db/fixtures/hibernations.yml (1)

15-55: 共通項目をYAMLアンカー化すると保守しやすくなります

scheduled_return_onreason が重複しているため、将来の文言変更時に編集漏れが起きやすいです。任意ですがアンカー化を検討してください。

♻️ 参考差分
+hbr_default: &hbr_default
+  scheduled_return_on: <%= Time.current + 30.days %>
+  reason: 学習時間が取れないため
+
 hibernation3:
+  <<: *hbr_default
   user: unhibernated
-  scheduled_return_on: <%= Time.current + 30.days %>
-  reason: 学習時間が取れないため
   created_at: <%= Time.current - 13.days %>

 hibernation4:
+  <<: *hbr_default
   user: autoretire-within-1-hour
-  scheduled_return_on: <%= Time.current + 30.days %>
-  reason: 学習時間が取れないため
   created_at: <%= Time.current - 3.months + 30.minutes %>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@db/fixtures/hibernations.yml` around lines 15 - 55, The fixtures repeat the
fields scheduled_return_on and reason across multiple hibernation entries;
extract those shared values into a YAML anchor (e.g., define
&default_hibernation with scheduled_return_on: <%= Time.current + 30.days %> and
reason: 学習時間が取れないため) and then reference them in each record using the alias
(*default_hibernation) or merge key (<<: *default_hibernation) so each
hibernation3..hibernation9 reuses the anchored values while keeping created_at
and user unique.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@db/fixtures/hibernations.yml`:
- Around line 15-55: The fixtures repeat the fields scheduled_return_on and
reason across multiple hibernation entries; extract those shared values into a
YAML anchor (e.g., define &default_hibernation with scheduled_return_on: <%=
Time.current + 30.days %> and reason: 学習時間が取れないため) and then reference them in
each record using the alias (*default_hibernation) or merge key (<<:
*default_hibernation) so each hibernation3..hibernation9 reuses the anchored
values while keeping created_at and user unique.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d8427ad and 620dfeb.

📒 Files selected for processing (1)
  • db/fixtures/hibernations.yml

休会理由を同じにしていたが、共通化する理由があるのだろうかと勘違いされる
可能性があると感じ、修正した
@matuaya
Copy link
Copy Markdown
Contributor

matuaya commented Mar 2, 2026

@s-tone-gs
お疲れ様です☺️
レビュー承りました!
数日ほどお時間いただけると幸いです🙇‍♀️

Copy link
Copy Markdown
Contributor

@matuaya matuaya left a comment

Choose a reason for hiding this comment

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

少し遅れてしまい申し訳ないです🙇‍♀️

休会情報バッチリ表示されていました!Approveさせていただきます☺️

@s-tone-gs s-tone-gs self-assigned this Mar 6, 2026
@s-tone-gs
Copy link
Copy Markdown
Contributor Author

@matuaya
ご確認ありがとうございます!

@komagata
生徒間レビューが完了しましたのでメンターレビューよろしくお願いいたします🙇‍♂️


hibernation3:
user: unhibernated
scheduled_return_on: <%= Time.current + 30.days %>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

なるべくnowやcurrentは使わず固定の時間にして、テストの方でtravel_toを使うやり方のほうがよいかなとおもいます。

なぜなら、現在時刻に依存したテストは再現性が低く、こまったテストになることがおおいからです。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@komagata
db/fixtures/以下にあるデータは自動テストでは使用されるものではないため、nowやcurrentを使用しても問題ないという認識です。これらは開発環境やステージング環境における、画面上での動作確認において使用されるシードデータだと認識しています。
こちらでも固定の時間にするべきでしょうか?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@s-tone-gs

すみません、test/fixturesと見間違えていました。修正しなくて大丈夫です。

Copy link
Copy Markdown
Member

@komagata komagata left a comment

Choose a reason for hiding this comment

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

確認させていただきました。OKです〜🙆‍♂️

@komagata komagata merged commit de1dd3b into main Mar 18, 2026
17 checks passed
@komagata komagata deleted the bug/inconsistent-seed-data branch March 18, 2026 07:32
@github-actions github-actions bot mentioned this pull request Mar 18, 2026
27 tasks
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