Skip to content

提出物が必要ないプラクティスにも提出物のタブが表示されているバグの修正・テストコードの実装#9654

Merged
machida merged 6 commits intomainfrom
bug/hide_empty_submissions_tab
Mar 2, 2026
Merged

提出物が必要ないプラクティスにも提出物のタブが表示されているバグの修正・テストコードの実装#9654
machida merged 6 commits intomainfrom
bug/hide_empty_submissions_tab

Conversation

@y-kawahara-gs
Copy link
Contributor

@y-kawahara-gs y-kawahara-gs commented Feb 16, 2026

Issue

概要

  • 提出物が必要ないプラクティスの提出物タブを表示しない処理に修正
  • テストコードの実装
    • 提出物がない場合に、提出物タブが隠れているテスト
    • 提出物がある場合に、提出物タブが表示されているテスト

変更確認方法

  1. bug/hide_empty_submissions_tabをローカルに取り込む
  2. ローカルサーバを起動する
  3. komagataでログインする
  4. プラクティスにアクセスする
  5. OS X Mountain Lionをクリーンインストールするにアクセスする
    ここで提出物のあるプラクティスは提出物タブが存在することを確認できる
  6. プラクティスにアクセスする
  7. PCの性能の見方を知るにアクセスする
    ここで提出物のないプラクティスは提出物タブが存在しないことを確認できる
    /practices/1019809339/productsにアクセスするとNot Foundが返る

Screenshot

変更前

  • 提出物があるプラクティスの場合

    image
  • 提出物のないプラクティスの場合

    image

変更後

  • 提出物があるプラクティスの場合

    image
  • 提出物のないプラクティスの場合

    image

Summary by CodeRabbit

  • バグ修正

    • 演習の「提出物」タブが、提出機能が有効な場合のみ表示されるように修正しました。
  • テスト

    • 提出物タブの表示/非表示を検証する自動テストを追加しました。
    • WIP関連のテストから、提出物タブの表示を前提とするアサーションを削除しました。

@coderabbitai
Copy link

coderabbitai bot commented Feb 16, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Practiceの取得をsubmission: trueでスコープし、viewの「提出物」タブ表示をpractice.submissionで条件付け。関連のシステムテストを追加し、別テストのタブ活性化アサーションを削除しています。

Changes

Cohort / File(s) Summary
Controller Query Scoping
app/controllers/practices/products_controller.rb
Practice.find(params[:practice_id])Practice.where(submission: true).find(params[:practice_id])に変更。提出物フラグが有効なPracticeのみを検索対象に。
Conditional Tab Rendering
app/helpers/page_tabs/practices_helper.rb
practice_page_tabsで「提出物」タブを常時表示からpractice.submissionが真の場合のみ表示するよう条件化。
System tests — Page tabs
test/system/practice/page_tabs_test.rb
Practice::PageTabsTestを追加。提出物タブが表示されるケースと表示されないケースをそれぞれ検証するテストを追加。
System tests — Product WIP
test/system/products/wip_test.rb
WIP送信後に「提出物」タブがアクティブであることを検証するアサーションを削除。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • okuramasafumi
  • zamami

Poem

🐰🌱 タブをぴょんと整理して、
提出物だけそっと見せるよ、
テストで確かめ、バグは追い払い、
小さな変更で道はすっきり、
みんなで跳ねるお祝いだよ!

🚥 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 タイトルはプルリクエストの主な変更内容(提出物が必要ないプラクティスの提出物タブ表示バグ修正とテスト実装)を明確に要約している。
Description check ✅ Passed 説明ではIssue番号、概要、変更確認方法、変更前後のスクリーンショットなど、テンプレートの主要項目がすべて適切に記載されている。

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bug/hide_empty_submissions_tab

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.

@y-kawahara-gs y-kawahara-gs self-assigned this Feb 16, 2026
@y-kawahara-gs y-kawahara-gs changed the title 提出物が必要ないプラクティスにも提出物のタブが表示されているバグの修正 提出物が必要ないプラクティスにも提出物のタブが表示されているバグの修正・テストコードの実装 Feb 16, 2026
@y-kawahara-gs y-kawahara-gs requested review from komagata and removed request for komagata February 16, 2026 09:24
@y-kawahara-gs y-kawahara-gs force-pushed the bug/hide_empty_submissions_tab branch from d12a827 to 9d53663 Compare February 17, 2026 02:14
@y-kawahara-gs y-kawahara-gs force-pushed the bug/hide_empty_submissions_tab branch from 20f6d53 to b3d679a Compare February 17, 2026 08:12
@y-kawahara-gs y-kawahara-gs marked this pull request as ready for review February 17, 2026 23:32
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: 1

🤖 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/practice/page_tabs_test.rb`:
- Line 5: クラス名がファイル名とRailsの命名規則に合っていません: Change the class declaration from
Practice::CompletionTest to Practice::PageTabsTest in the test file so the class
name matches page_tabs_test.rb; locate the class definition line (class
Practice::CompletionTest < ApplicationSystemTestCase) and rename the constant to
Practice::PageTabsTest, keeping the existing superclass and any test contents
unchanged.

@y-kawahara-gs y-kawahara-gs requested a review from zamami February 18, 2026 00:03
@y-kawahara-gs
Copy link
Contributor Author

@zamami
お疲れ様です!レビューをお願いしたいです。
もし忙しそうでしたら一報いただければと思います。🙏

@zamami
Copy link
Contributor

zamami commented Feb 18, 2026

@y-kawahara-gs
レビュー依頼ありがとうございます。
今夜着手いたします!

@zamami
Copy link
Contributor

zamami commented Feb 25, 2026

@y-kawahara-gs
レビュー遅くなってすいません。
お昼にはレビューお返しします!

@zamami
Copy link
Contributor

zamami commented Feb 25, 2026

@y-kawahara-gs
development.rbconfig.action_controller.perform_caching = falsetrue
にしたところ無事404が表示されました。
image

Copy link
Contributor

@zamami zamami left a comment

Choose a reason for hiding this comment

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

見たところ特に問題なさそうです。
実装お疲れ様でした!

@y-kawahara-gs
Copy link
Contributor Author

@okuramasafumi
お疲れ様です!
メンバーレビューが完了したので、レビューをお願いします!

Copy link
Contributor

@okuramasafumi okuramasafumi left a comment

Choose a reason for hiding this comment

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

LGTM!

@y-kawahara-gs
Copy link
Contributor Author

@komagata @machida
お疲れ様です。メンターレビューが通ったので、マージお願いします!

@machida machida merged commit cc8bb98 into main Mar 2, 2026
7 checks passed
@machida machida deleted the bug/hide_empty_submissions_tab branch March 2, 2026 01:57
@machida
Copy link
Member

machida commented Mar 2, 2026

@y-kawahara-gs 連絡ありがとうございます!マージしましたー

@github-actions github-actions bot mentioned this pull request Mar 2, 2026
17 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.

4 participants