Skip to content

給付金コースのプラクティスとコピー元のプラクティス間に相互リンクを作成#9821

Open
s-tone-gs wants to merge 8 commits intomainfrom
feature/add-cross-link-grant-course-practices
Open

給付金コースのプラクティスとコピー元のプラクティス間に相互リンクを作成#9821
s-tone-gs wants to merge 8 commits intomainfrom
feature/add-cross-link-grant-course-practices

Conversation

@s-tone-gs
Copy link
Copy Markdown
Contributor

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

Issue

概要

給付金コースのプラクティスと、その元になっているプラクティスとの間で、給付金コースを受講している生徒のみが使用できる相互リンクを作成した。

変更確認方法

  1. feature/add-cross-link-grant-course-practicesをローカルに取り込む
  2. bin/rails db:seed:replantを実行
  3. bin/setupを実行
  4. 給付金コースを受講するユーザーでログイン
  • grant-course
  • testtest
  1. 給付金コースのプラクティスを開く
  2. ピル型ナビが表示されていることを確認する。(見た目は変更後のスクショを参照)
  3. 「元プラクティス」を押し、コピー元のプラクティスに遷移することを確認する。
  4. 「給付金コース」を押し、給付金コースのプラクティスに遷移することを確認する。
  5. 給付金コースを受講していないユーザーでログインする
  • hajime
  • testtest
  1. コピー元のプラクティスを開き、ピル型ナビが存在しないことを確認する。

Screenshot

変更前

image

変更後

image

Summary by CodeRabbit

  • 新機能

    • プラクティスページに権限付きのピル式タブを追加し、「元プラクティス」と「給付金コース」を切替可能に
    • 給付金コースと元コースの差分を説明する注記を追加
  • データ

    • 新カテゴリ「Ruby(Reスキル)」と複数のプラクティス/コースへの紐付けを追加
    • テスト/初期用のユーザー・Discord・トーク等のフィクスチャを追加
  • テスト

    • ナビゲーション表示権限のシステムテストを追加
    • テスト内セレクターを汎用化して安定化

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

給付金コース権限を持つユーザー向けに、表示中プラクティスとその「元プラクティス/給付金コース」へ切り替えるピル型ナビと説明文をビューに追加。併せてカテゴリ/プラクティス/コース/ユーザー関連のDBおよびテストフィクスチャを追加・更新し、システムテストと一部セレクタを修正しました。

Changes

Cohort / File(s) Summary
ビュー テンプレート
app/views/practices/show.html.slim
current_user.grant_course? 条件でピル型ナビ(「元プラクティス」「給付金コース」)と説明文を追加。リンク先は @practice.source_practice / @practice.copied_practices.first を参照し、アクティブ判定を調整。
DB フィクスチャ:カテゴリ
db/fixtures/categories.yml
category23 の引用符を単一引用へ変更、category24Ruby(Reスキル))を追加。
DB フィクスチャ:カテゴリ⇄プラクティス / コース⇄カテゴリ / プラクティス
db/fixtures/categories_practices.yml, db/fixtures/courses_categories.yml, db/fixtures/practices.yml
category24 に対する categories_practice67/68courses_category46 を追加。practice113practice114 を追加し、それぞれ source_practice を参照。
DB フィクスチャ:ユーザー/トーク/Discord
db/fixtures/users.yml, db/fixtures/talks.yml, db/fixtures/discord_profiles.yml
grant-course ユーザーと関連する talk_grant_course / discord_profile_grant-course を追加。ファイル末尾の改行有無に差異あり。
テスト フィクスチャ:カテゴリ / プラクティス / コース / ユーザー 等
test/fixtures/categories.yml, test/fixtures/categories_practices.yml, test/fixtures/courses_categories.yml, test/fixtures/practices.yml, test/fixtures/users.yml, test/fixtures/talks.yml, test/fixtures/discord_profiles.yml
category24 と紐付けたテスト用フィクスチャを追加。practice64 を追加、既存の一部文字列引用符を単一引用に統一。grant-course テストユーザ/talk/discord_profile を追加。
システム テスト
test/system/practices_test.rb
給付金コースと元プラクティス間のナビゲーションと表示権限を確認するシステムテストを追加。
セレクタ更新(テスト)
test/system/questions/change_user_test.rb
ユーザー/プラクティス選択のセレクタを固定IDから汎用セレクタ(.choices__item--choice と表示テキスト)へ変更。

Sequence Diagram(s)

(該当なし)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • machida
  • okuramasafumi
  • komagata

Poem

🐰🌱
タブをぴょん、元と給付を見渡す、
フィクスチャ並べて道をつなぐ、
テストで確かめてぴょんと戻る、
小さな変更、跳ねる春の合図。 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed PRのタイトルは「給付金コースのプラクティスとコピー元のプラクティス間に相互リンクを作成」で、変更セットの主要な目的と一致している。簡潔で具体的に相互リンク機能の追加を説明している。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed PR説明は要件テンプレートのほぼすべてのセクションを含んでおり、Issue番号、概要、変更確認方法、スクリーンショット(変更前後)が適切に記載されている。

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/add-cross-link-grant-course-practices

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 feature/add-cross-link-grant-course-practices branch from bc3e588 to f559630 Compare March 24, 2026 01:46
@s-tone-gs
Copy link
Copy Markdown
Contributor Author

s-tone-gs commented Mar 24, 2026

@machida
お疲れ様です!
給付金コースのプラクティスとコピー元とのリンクですが、現状仮でapp/views/practices/show.html.slimに以下のように実装しています。こちらデザインをお願いしてもよろしいでしょうか?
image
image

@machida
Copy link
Copy Markdown
Member

machida commented Mar 24, 2026

@s-tone-gs 連絡ありがとうございます!はい!その状態で大丈夫ですー
デザイン入れます💪

@s-tone-gs
Copy link
Copy Markdown
Contributor Author

s-tone-gs commented Mar 24, 2026

@machida
こちらのデザインも今週の木曜までにお願いしたいです🙇‍♂️
よろしくお願いいたします🙇‍♂️

@machida
Copy link
Copy Markdown
Member

machida commented Mar 24, 2026

了解です!

@machida machida self-assigned this Mar 24, 2026
@machida
Copy link
Copy Markdown
Member

machida commented Mar 24, 2026

@s-tone-gs デザイン入れましたー

@machida machida removed their assignment Mar 24, 2026
@s-tone-gs
Copy link
Copy Markdown
Contributor Author

@machida
迅速な対応ありがとうございます~!(´;ω;`)

@s-tone-gs s-tone-gs force-pushed the feature/add-cross-link-grant-course-practices branch from 0db21a9 to ece588c Compare March 24, 2026 07:46
@s-tone-gs s-tone-gs marked this pull request as ready for review March 24, 2026 07:57
@github-actions github-actions bot requested a review from okuramasafumi March 24, 2026 07: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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
test/fixtures/courses_categories.yml (1)

141-144: ⚠️ Potential issue | 🔴 Critical

courses_category29 が重複していて fixture が壊れます。

Line 146 で同じキーを再定義しているため、Line 141 の course4 向けエントリが上書きされるか、fixture の読み込み自体が失敗します。新規エントリは未使用のキー名にしてください。

🔧 修正例
-courses_category29:
+courses_category30:
   course: course5
   category: category24
   position: 1

Also applies to: 146-149

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/fixtures/courses_categories.yml` around lines 141 - 144, The fixture
defines the same mapping key courses_category29 twice, which breaks loading and
overwrites the course4/category3 entry; fix by renaming the later duplicate key
to a unique unused key (e.g., courses_category30) so both entries (the one
referencing course4/category3/position:3 and the later entry) coexist; update
any tests or references expecting the new key if necessary and ensure no other
keys are duplicated in test/fixtures/courses_categories.yml.
db/fixtures/discord_profiles.yml (1)

334-337: ⚠️ Potential issue | 🔴 Critical

discord_profile_new-mentor の重複で既存 seed が壊れます。

Line 339 で discord_profile_new-mentor を再定義しているので、Line 334 の new-mentor 用プロフィールが上書きされるか、YAML の読み込みで失敗します。grant-course 用に別キーへリネームしてください。

🔧 修正例
-discord_profile_new-mentor:
+discord_profile_grant-course:
   user: grant-course
   account_name: grant-course
   times_url:

Also applies to: 339-342

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@db/fixtures/discord_profiles.yml` around lines 334 - 337, The YAML seed
defines duplicate keys "discord_profile_new-mentor" causing overwrite or parse
errors; rename the second occurrence used for the grant-course profile to a
unique key (e.g., "discord_profile_grant-course" or
"discord_profile_new-mentor-grant-course") so both profiles exist separately,
update any references that expect the grant-course profile to use the new key,
and ensure the entries at the duplicate blocks (the one starting at Line 334 and
the repeated block at 339-342) are distinct.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/system/questions/change_user_test.rb`:
- Line 27: Replace fragile ID-based selectors that target
'#choices--js-choices-user-item-choice-14' with a class-and-text based selector:
locate the choice by using the '.choices__item--choice' selector together with
the existing text matcher (text: 'hatsuno') and call click on that element;
update all three occurrences that currently use
'#choices--js-choices-user-item-choice-14' (the find calls at the three
locations) to use '.choices__item--choice' + text matcher instead to avoid ID
brittleness.

---

Outside diff comments:
In `@db/fixtures/discord_profiles.yml`:
- Around line 334-337: The YAML seed defines duplicate keys
"discord_profile_new-mentor" causing overwrite or parse errors; rename the
second occurrence used for the grant-course profile to a unique key (e.g.,
"discord_profile_grant-course" or "discord_profile_new-mentor-grant-course") so
both profiles exist separately, update any references that expect the
grant-course profile to use the new key, and ensure the entries at the duplicate
blocks (the one starting at Line 334 and the repeated block at 339-342) are
distinct.

In `@test/fixtures/courses_categories.yml`:
- Around line 141-144: The fixture defines the same mapping key
courses_category29 twice, which breaks loading and overwrites the
course4/category3 entry; fix by renaming the later duplicate key to a unique
unused key (e.g., courses_category30) so both entries (the one referencing
course4/category3/position:3 and the later entry) coexist; update any tests or
references expecting the new key if necessary and ensure no other keys are
duplicated in test/fixtures/courses_categories.yml.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f4258cc7-36b3-45b2-b9f6-2d162cc26a23

📥 Commits

Reviewing files that changed from the base of the PR and between 215d51e and ece588c.

📒 Files selected for processing (17)
  • app/views/practices/show.html.slim
  • db/fixtures/categories.yml
  • db/fixtures/categories_practices.yml
  • db/fixtures/courses_categories.yml
  • db/fixtures/discord_profiles.yml
  • db/fixtures/practices.yml
  • db/fixtures/talks.yml
  • db/fixtures/users.yml
  • test/fixtures/categories.yml
  • test/fixtures/categories_practices.yml
  • test/fixtures/courses_categories.yml
  • test/fixtures/discord_profiles.yml
  • test/fixtures/practices.yml
  • test/fixtures/talks.yml
  • test/fixtures/users.yml
  • test/system/practices_test.rb
  • test/system/questions/change_user_test.rb

@s-tone-gs s-tone-gs force-pushed the feature/add-cross-link-grant-course-practices branch from ece588c to 876d53a Compare March 24, 2026 08:43
@s-tone-gs

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

@fjordllc fjordllc deleted a comment from coderabbitai bot Mar 24, 2026
@s-tone-gs s-tone-gs force-pushed the feature/add-cross-link-grant-course-practices branch from 876d53a to 4eb3de5 Compare March 24, 2026 12:18
@s-tone-gs

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

@s-tone-gs s-tone-gs force-pushed the feature/add-cross-link-grant-course-practices branch 2 times, most recently from 48ba406 to 9398667 Compare March 25, 2026 00:25
給付金コースの受講生を追加した影響で落ちたテストの修正
idで要素を指定していたため安定性の無いテストになっていた
テキストで要素を指定しているためID固定出の指定は不要だと判断し修正した
machida and others added 4 commits March 25, 2026 09:27
テキストが表示されないことをチェックするだけでは
エラーでページが表示されなかった場合も通ってしまうので修正した
テキストのみのチェックではなくパスもチェックしてより堅牢にした
@s-tone-gs s-tone-gs force-pushed the feature/add-cross-link-grant-course-practices branch from 9398667 to d298c57 Compare March 25, 2026 00:28
@s-tone-gs s-tone-gs requested a review from zecky1120 March 25, 2026 00:45
@s-tone-gs
Copy link
Copy Markdown
Contributor Author

@zecky1120 お疲れ様です!レビュー依頼させていただきました!よろしくお願いいたします🙇‍♂️
急ぎではありませんが、キャパ的に厳しい場合は教えていただけるとありがたいです!

@zecky1120
Copy link
Copy Markdown
Contributor

@s-tone-gs
承知しました! 今週中にご連絡します〜🙇‍♂️

@zecky1120
Copy link
Copy Markdown
Contributor

zecky1120 commented Mar 30, 2026

@s-tone-gs
遅くなってしまい申し訳ございません。
変更確認方法の3でログインできなかったのですが、、ご確認いただけたらと思います〜😅
※8のログイン情報では出来ました

もしくは左下のアイコンユーザーで給付金コースを受講しているユーザーはいますか?
スクリーンショット 2026-03-30 20 18 36

@s-tone-gs
Copy link
Copy Markdown
Contributor Author

@zecky1120
連絡ありがとうございます~!
bin/rails db:seed:replantを実行した後にもう一度試していただけますか??

bin/setupで実行されるrails db:prepareは、データベースとテーブルが存在する場合シードデータを再読み込みしてくれないみたいです。おそらくそれが原因で新しく作った給付金コースのユーザーのデータが未注入のままになっていると思われます。すみません自分の指示が抜けていました🙇‍♂️
ref: https://railsguides.jp/active_record_migrations.html#%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E3%82%92%E6%BA%96%E5%82%99%E3%81%99%E3%82%8B

お忙しいところ恐縮ですが、よろしくお願いします!

もしくは左下のアイコンユーザーで給付金コースを受講しているユーザーはいますか

いないはずですね🤔

Copy link
Copy Markdown
Contributor

@zecky1120 zecky1120 left a comment

Choose a reason for hiding this comment

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

@s-tone-gs
確認できました〜✨ OKです

@s-tone-gs
Copy link
Copy Markdown
Contributor Author

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

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

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