Skip to content

日報・ブログのタブを修正する#8976

Merged
komagata merged 20 commits intomainfrom
feature/change_place_of_report_and_blog_tabs
Aug 27, 2025
Merged

日報・ブログのタブを修正する#8976
komagata merged 20 commits intomainfrom
feature/change_place_of_report_and_blog_tabs

Conversation

@sharoa119
Copy link
Copy Markdown
Contributor

@sharoa119 sharoa119 commented Jul 22, 2025

Issue

概要

現在、このようになっていて、未チェックの日報タブは一部のユーザーにだけ表示されている。
now
それを、次のように変更。未チェックの日報タブ、未チェックの日報数は一部のユーザーにだけ表示されるようにする。

feature

(のちに、「全て」と「未チェック」の下に、「プラクティスで絞り込む」を配置することを確認しました。)

変更確認方法

  1. feature/change_place_of_report_and_blog_tabsをローカルに取り込む
git fetch origin feature/change_place_of_report_and_blog_tabs
git checkout feature/change_place_of_report_and_blog_tabs
  1. foreman start -f Procfile.devでローカル環境を立ち上げる
  2. まずはkomagata(管理者かメンター)のアカウントでログインをする
  3. 左側の「日報・ブログ」タブをクリックする
  4. タブが「日報」と「みんなのブログ」の2つになっていることを確認
  5. 「日報」タブでは、全て未チェックのタブがあり、未チェックがある場合はその数値が日報タブの右上に表示されていることを確認
  6. 未チェック選択時は、プラクティスで絞り込むは非表示になっていることを確認
    (これは町田さんからの要望の画像です。)
image1
  1. 「みんなのブログ」タブを選択時は、+日報作成は無いことを確認
  2. 「日報」「みんなのブログ」の双方のタブに、タイトルがついていることを確認
  3. 次に、komagataをログアウトしてkimura(管理者・メンター以外)でログインする
  4. 左側の「日報・ブログ」タブをクリックする
  5. 「日報」タブで、管理者orメンターでログインしている時に表示されていた「日報」タブの右上の数値と、全て未チェックのタブが非表示になっていることを確認

Screenshot

変更前

スクリーンショット 2025-07-17 12 21 54

変更後

2025-07-22.15.11.33.mov

Summary by CodeRabbit

  • 新機能

    • 管理者・メンターが日報一覧内で「未チェック」フィルタを切替可能に(ページ内切替とタブバッジ統合)。
  • 改善

    • 日報/外部エントリのヘッダーとレイアウトを再編成し、タイトル・作成ボタン・フィルター配置を整理。
    • グローバルナビの日報リンクを常時 reports へ簡素化し、外部エントリもアクティブ判定に含める。
  • 削除

    • 未チェック専用ページ/コントローラ/ルートおよび該当ビューを廃止。
  • テスト

    • 外部エントリで日報作成ボタンが表示されないことのシステムテスト追加、未チェック関連テストの削除、プラクティス絞込と表示挙動を検証するテスト追加。

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jul 22, 2025

Walkthrough

未チェック専用コントローラ・ビュー・ルート・関連システムテストを削除し、reports#indexparams[:unchecked] フィルタ(admin_or_mentor_login? の場合のみ)を統合。タブを単一の「日報」へ統合し、グローバルナビ・外部エントリーページ・関連テストを調整しました。

Changes

Cohort / File(s) Change Summary
未チェック機能削除
app/controllers/reports/unchecked_controller.rb, app/views/reports/unchecked/index.html.slim, test/system/report/unchecked_test.rb
未チェック専用のコントローラ、ビュー、関連システムテストを削除。
reports#index 統合・ビュー整理
app/controllers/reports_controller.rb, app/views/reports/index.html.slim, app/helpers/page_tabs/reports_helper.rb
reports#indexparams[:unchecked] フィルタを追加(admin_or_mentor_login? 時のみ)。未チェックタブを「日報」タブに統合しバッジ表示へ。new_report 部分とプラクティスフィルタの配置・表示条件を変更。
グローバルナビ修正
app/views/application/_global_nav.slim
reports ナビリンクを常に reports_path にし、アクティブ判定を `/^(reports
外部エントリーレイアウト調整
app/views/external_entries/index.html.slim
ヘッダ構造を main.page-main に変更し、new_report 表示位置を移動、report_page_tabs 呼び出しを削除。タイトル/メタ記述の配置を更新。
ルーティング整理
config/routes/reports.rb
reports/unchecked ネストルートを削除。resources :checksonly 記法を %i[...] から [:create, :destroy] に変更。
テスト追加・修正
test/system/reports_practice_filter_test.rb, test/system/external_entries_test.rb, test/system/searchables_test.rb, test/system/reports_test.rb
プラクティス絞り込み用のシステムテストを追加、外部エントリーページに「日報作成」ボタンが表示されないことを確認するテストを追加、avatar リセット後に user.reload を追加、一部未チェック関連テストを削除。

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Browser
    participant ReportsController
    participant ReportModel
    participant View

    User->>Browser: GET /reports or /reports?unchecked=1
    Browser->>ReportsController: request (params)
    alt params[:unchecked] present and admin_or_mentor_login?
        ReportsController->>ReportModel: query Report.unchecked.not_wip.list.page(...).per(...)
    else
        ReportsController->>ReportModel: query Report.list (optional practice filter) + pagination
    end
    ReportModel-->>ReportsController: records
    ReportsController->>View: render reports/index (single "日報" タブ with badge if allowed)
    View-->>Browser: HTML
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 分

Possibly related issues

Possibly related PRs

Suggested reviewers

  • komagata

Poem

ぴょんと跳ねるウサギだよ、
タブはひとつで道はすっきり、
コントローラはさよならして、
ビューとテストはきちんと直したよ、
レビュー待ってるよ、よろしくね 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 RuboCop (1.76.1)
test/system/reports_practice_filter_test.rb

rubocop-minitest extension supports plugin, specify plugins: rubocop-minitest instead of require: rubocop-minitest in /.rubocop.yml.
For more information, see https://docs.rubocop.org/rubocop/plugin_migration_guide.html.
rubocop-capybara extension supports plugin, specify plugins: rubocop-capybara instead of require: rubocop-capybara in /.rubocop.yml.
For more information, see https://docs.rubocop.org/rubocop/plugin_migration_guide.html.
Unable to find gem rubocop-fjord; is the gem installed? Gem::MissingSpecError
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:309:in rescue in gem_config_path' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:293:in gem_config_path'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:84:in block (2 levels) in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:82:in reverse_each'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:82:in block in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:76:in each_pair'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:76:in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader.rb:58:in load_file'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_store.rb:29:in options_config=' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:162:in act_on_options'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:47:in block in run' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:82:in profile_if_needed'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:43:in run' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/exe/rubocop:19:in <top (required)>'
/usr/local/bin/rubocop:25:in load' /usr/local/bin/rubocop:25:in

'

app/controllers/reports_controller.rb

rubocop-minitest extension supports plugin, specify plugins: rubocop-minitest instead of require: rubocop-minitest in /.rubocop.yml.
For more information, see https://docs.rubocop.org/rubocop/plugin_migration_guide.html.
rubocop-capybara extension supports plugin, specify plugins: rubocop-capybara instead of require: rubocop-capybara in /.rubocop.yml.
For more information, see https://docs.rubocop.org/rubocop/plugin_migration_guide.html.
Unable to find gem rubocop-fjord; is the gem installed? Gem::MissingSpecError
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:309:in rescue in gem_config_path' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:293:in gem_config_path'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:84:in block (2 levels) in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:82:in reverse_each'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:82:in block in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:76:in each_pair'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:76:in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader.rb:58:in load_file'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_store.rb:29:in options_config=' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:162:in act_on_options'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:47:in block in run' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:82:in profile_if_needed'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:43:in run' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/exe/rubocop:19:in <top (required)>'
/usr/local/bin/rubocop:25:in load' /usr/local/bin/rubocop:25:in

'

config/routes/reports.rb

rubocop-minitest extension supports plugin, specify plugins: rubocop-minitest instead of require: rubocop-minitest in /.rubocop.yml.
For more information, see https://docs.rubocop.org/rubocop/plugin_migration_guide.html.
rubocop-capybara extension supports plugin, specify plugins: rubocop-capybara instead of require: rubocop-capybara in /.rubocop.yml.
For more information, see https://docs.rubocop.org/rubocop/plugin_migration_guide.html.
Unable to find gem rubocop-fjord; is the gem installed? Gem::MissingSpecError
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:309:in rescue in gem_config_path' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:293:in gem_config_path'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:84:in block (2 levels) in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:82:in reverse_each'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:82:in block in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:76:in each_pair'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:76:in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader.rb:58:in load_file'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_store.rb:29:in options_config=' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:162:in act_on_options'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:47:in block in run' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:82:in profile_if_needed'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:43:in run' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/exe/rubocop:19:in <top (required)>'
/usr/local/bin/rubocop:25:in load' /usr/local/bin/rubocop:25:in

'

  • 3 others

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/change_place_of_report_and_blog_tabs

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sharoa119 sharoa119 changed the title Feature/change place of report and blog tabs 日報・ブログのタブを修正する Jul 22, 2025
@sharoa119
Copy link
Copy Markdown
Contributor Author

@machida さん
お疲れ様です!
こちらのデザインをお願いいたします🙇‍♀️

@machida
Copy link
Copy Markdown
Member

machida commented Jul 22, 2025

@sharoa119 デザイン入れましたー

@machida machida removed their assignment Jul 22, 2025
@sharoa119
Copy link
Copy Markdown
Contributor Author

@machida さん
お疲れ様です。
素早い対応でありがたいです✨

@sharoa119 sharoa119 marked this pull request as ready for review July 23, 2025 01:35
@sharoa119
Copy link
Copy Markdown
Contributor Author

@su-su-su-su  さん
お疲れ様です!
こちらお手すきでレビューをお願いできますでしょうか🙂

@sharoa119 sharoa119 requested review from machida and su-su-su-su July 23, 2025 01:42
@su-su-su-su
Copy link
Copy Markdown
Contributor

@sharoa119
お疲れ様です!
承知しました。
1週間ほどみていただければと思います🙏
よろしくお願いいたします!

@su-su-su-su
Copy link
Copy Markdown
Contributor

@sharoa119
お疲れ様です!1点確認があります。

要望画像のような全て未チェックのUIになっていないです。
.user-reports__filtersのCSSがないように思います。
そのため、全て未チェックのリンクが左端にそのまま表示されているのだと思います。
ご確認お願いいたします🙏

@sharoa119
Copy link
Copy Markdown
Contributor Author

sharoa119 commented Jul 30, 2025

@su-su-su-su さん
お疲れ様です。
遅くなってすみません💦
そして、デザインの確認ができていなくて申し訳なかったです。(確認しなきゃ、と思いつつそのまま他のことをして失念していました💦)
ごめんなさい🙇‍♀️

そして、自分のところで確認したら確かにデザインが入っていませんでした💦
なので、町田さんに確認したいと思います〜〜

お願いがあるのですが、デザインのことなので最初のコメント時に、一緒に町田さんをメンションしていただけると助かります〜🙏

それではしばしお待ちください。

@sharoa119
Copy link
Copy Markdown
Contributor Author

@machida さん
お疲れ様です。

こちらのissueですが、デザインを入れてくださったとあったのですが

レビュアーの @su-su-su-su さんから

要望画像のような全てと未チェックのUIになっていないです。
.user-reports__filtersのCSSがないように思います。
そのため、全てと未チェックのリンクが左端にそのまま表示されているのだと思います。

とコメントいただき、確認したところ、デザインが入っていませんでした💦

タイトルが左に寄っていたり、「+日報作成」が真ん中にあったりなど、CSSがきいていないようです。
スクリーンショット 2025-07-30 11 31 01

ご確認をお願いいたします🙇‍♀️

@machida
Copy link
Copy Markdown
Member

machida commented Jul 30, 2025

@sharoa119 あれ?すいません、確認します🙇‍♂️

@machida
Copy link
Copy Markdown
Member

machida commented Jul 30, 2025

@sharoa119 @su-su-su-su

すいません、コミット忘れがあったのか、デザインが抜けていました🙇‍♂️
今プッシュをしたのでご確認お願いします🙏

image image image

@sharoa119
Copy link
Copy Markdown
Contributor Author

@machida さん
お疲れ様です!
お忙しいところ、ご対応くださりありがとうございます!
先ほど確認して、私のマシンでもデザインが反映されていることが確認できました〜。
ありがとうございます☺️

@su-su-su-su さん
お疲れ様です。
町田さんにデザインの確認をしてもらい、入れていただきました!!
恐れ入りますが、再度ご確認のほどよろしくお願いいたします。

Copy link
Copy Markdown
Contributor

@su-su-su-su su-su-su-su left a comment

Choose a reason for hiding this comment

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

@sharoa119
お疲れ様です!お待たせしました🙏
問題なさそうでしたのでapproveさせていただきます!

@sharoa119
Copy link
Copy Markdown
Contributor Author

@su-su-su-su さん
おはようございます!
ご確認くださりありがとうございました!!

@komagata さん
お疲れ様です。
メンバーレビューが終わりましたので
ご確認のほど、よろしくお願いいたします🙇‍♀️

@komagata
Copy link
Copy Markdown
Member

komagata commented Aug 4, 2025

@sharoa119 conflictの修正をお願いします〜

@sharoa119 sharoa119 force-pushed the feature/change_place_of_report_and_blog_tabs branch from b025803 to f37b09d Compare August 5, 2025 02:37
@sharoa119
Copy link
Copy Markdown
Contributor Author

@komagata さん
お疲れ様です。
コンフリクトを修正したのですが、
CIテストが「CircleCI received exit code 137」と出て、すすみません💦
調べたところ

これは Linux のエラーコードで、CircleCI 上のコンテナで使用できるメモリが不足した場合に表示されることがあります。

とあったのですが、これはどのように対応したら良いのでしょうか。

ちょうどディスコードでsekitoさんがおっしゃっている内容が当てはまるのかな、とも思ったりです。

解決方法をご教示いただければと思います🙇‍♀️

@sharoa119 sharoa119 force-pushed the feature/change_place_of_report_and_blog_tabs branch 2 times, most recently from 7e4627a to 92becec Compare August 12, 2025 05:23
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: 3

🧹 Nitpick comments (1)
app/views/external_entries/index.html.slim (1)

21-23: 空の .page-header-actions を条件付きで出力するか削除を検討

現在中身がなく出力されるだけなので、DOMノイズになります。将来の拡張予定がなければ削除、あるいはコンテンツがある場合のみ描画するのが望ましいです。

提案(用途がなければ削除):

-        .page-main-header__end
-          .page-header-actions
+        / .page-main-header__end はこのタブでは未使用のため削除

コンポーネント再利用の都合で残す場合は、content_for? 等で条件出力をご検討ください。

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e4627a and 92becec.

⛔ Files ignored due to path filters (1)
  • Gemfile.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • app/controllers/reports/unchecked_controller.rb (0 hunks)
  • app/controllers/reports_controller.rb (1 hunks)
  • app/helpers/page_tabs/reports_helper.rb (1 hunks)
  • app/views/application/_global_nav.slim (1 hunks)
  • app/views/external_entries/index.html.slim (1 hunks)
  • app/views/reports/index.html.slim (1 hunks)
  • app/views/reports/unchecked/index.html.slim (0 hunks)
  • config/routes/reports.rb (1 hunks)
  • test/system/report/unchecked_test.rb (0 hunks)
  • test/system/reports_test.rb (0 hunks)
  • test/system/searchables_test.rb (1 hunks)
💤 Files with no reviewable changes (4)
  • test/system/reports_test.rb
  • app/controllers/reports/unchecked_controller.rb
  • app/views/reports/unchecked/index.html.slim
  • test/system/report/unchecked_test.rb
🚧 Files skipped from review as they are similar to previous changes (4)
  • app/controllers/reports_controller.rb
  • app/helpers/page_tabs/reports_helper.rb
  • config/routes/reports.rb
  • app/views/reports/index.html.slim
🧰 Additional context used
📓 Path-based instructions (2)
**/*.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/searchables_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/searchables_test.rb
🧬 Code Graph Analysis (1)
test/system/searchables_test.rb (1)
test/supports/avatar_helper.rb (1)
  • reset_avatar (6-14)
⏰ 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)
test/system/searchables_test.rb (1)

189-191: fixture の明示的な変数化と reload の追加は妥当(テスト安定性の向上)

users(:komagata) をローカル変数に入れて reset_avatar(user) を呼び、直後に user.reload しているのは、ActiveStorage の関連キャッシュを確実に最新化する意図として適切です。この変更は安全で、システムテストのフレーク低減に寄与します。

app/views/external_entries/index.html.slim (1)

14-35: レイアウトの刷新は要件を満たしており妥当です(+日報作成ボタンの非表示もOK)

  • main.page-main 配下にページタイトル「みんなのブログ」を持つ h1 を設け、ヘッダの右側から new_report を外した点は要件と一致しています。
  • 未登録フィードの注意喚起も維持されており、視覚的な区切り(hr)も良いです。

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: 2

🧹 Nitpick comments (1)
test/system/external_entries_test.rb (1)

26-30: 冗長/不正確なアサーションを整理する。

  • assert_no_link '日報作成'assert_no_selector 'a.btn', text: '日報作成' は実質的に同じ意図で、後者はこのプロジェクトのBEM風クラス(例: a-button)とも整合しないため将来のメンテに不利です。
  • ボタンの非表示確認はリンクテキストの不在で十分です(クラス名変更の影響を受けにくい)。

a.btn の行を削除することを推奨します。

提案差分:

   test 'does not show "New Report" button on External Entries page' do
     visit_with_auth external_entries_url, 'komagata'
     assert_no_link '日報作成'
-    assert_no_selector 'a.btn', text: '日報作成'
   end
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 92becec and d2ef467.

📒 Files selected for processing (3)
  • app/views/application/_global_nav.slim (1 hunks)
  • test/system/external_entries_test.rb (1 hunks)
  • test/system/searchables_test.rb (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/views/application/_global_nav.slim
  • test/system/searchables_test.rb
🧰 Additional context used
📓 Path-based instructions (2)
**/*.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/external_entries_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/external_entries_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

@sharoa119 sharoa119 force-pushed the feature/change_place_of_report_and_blog_tabs branch from eed2821 to e290951 Compare August 12, 2025 07:16
@sharoa119 sharoa119 force-pushed the feature/change_place_of_report_and_blog_tabs branch from 0063c61 to a3a6886 Compare August 26, 2025 05:43
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: 0

🧹 Nitpick comments (1)
test/system/external_entries_test.rb (1)

32-36: 重複アサーションの共通化+厳密一致で誤検知を抑制

2つのテストで同一アサーションが繰り返されているため、ヘルパーに切り出すとDRYになります。あわせて assert_no_linkexact: true を付けると部分一致の誤検知を避けられます(任意)。

以下をテストクラス内に追加(例: 最後に private メソッドとして):

private

def assert_no_new_report_button
  assert_no_link '日報作成', exact: true
  assert_no_selector 'a.btn', text: '日報作成'
end

該当箇所をこのヘルパー呼び出しに置き換え:

-    assert_no_link '日報作成'
-    assert_no_selector 'a.btn', text: '日報作成'
+    assert_no_new_report_button

同様に先のテスト(Line 28-29)も以下のように置き換え可能です:

-    assert_no_link '日報作成'
-    assert_no_selector 'a.btn', text: '日報作成'
+    assert_no_new_report_button
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0063c61 and a3a6886.

📒 Files selected for processing (13)
  • app/controllers/reports/unchecked_controller.rb (0 hunks)
  • app/controllers/reports_controller.rb (1 hunks)
  • app/helpers/page_tabs/reports_helper.rb (1 hunks)
  • app/views/application/_global_nav.slim (1 hunks)
  • app/views/external_entries/index.html.slim (1 hunks)
  • app/views/reports/index.html.slim (1 hunks)
  • app/views/reports/unchecked/index.html.slim (0 hunks)
  • config/routes/reports.rb (1 hunks)
  • test/system/external_entries_test.rb (1 hunks)
  • test/system/report/unchecked_test.rb (0 hunks)
  • test/system/reports_practice_filter_test.rb (1 hunks)
  • test/system/reports_test.rb (0 hunks)
  • test/system/searchables_test.rb (1 hunks)
💤 Files with no reviewable changes (4)
  • test/system/reports_test.rb
  • app/controllers/reports/unchecked_controller.rb
  • test/system/report/unchecked_test.rb
  • app/views/reports/unchecked/index.html.slim
🚧 Files skipped from review as they are similar to previous changes (8)
  • app/helpers/page_tabs/reports_helper.rb
  • app/views/application/_global_nav.slim
  • app/views/external_entries/index.html.slim
  • app/controllers/reports_controller.rb
  • test/system/reports_practice_filter_test.rb
  • app/views/reports/index.html.slim
  • test/system/searchables_test.rb
  • config/routes/reports.rb
🧰 Additional context used
📓 Path-based instructions (2)
**/*.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/external_entries_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/external_entries_test.rb
🧠 Learnings (1)
📓 Common learnings
Learnt from: jun-kondo
PR: fjordllc/bootcamp#8977
File: app/controllers/reports_controller.rb:63-63
Timestamp: 2025-07-23T20:31:13.856Z
Learning: fjordllc/bootcampプロジェクトの`app/controllers/reports_controller.rb`において、`create`と`update`アクションは両方とも`report.save_uniquely`を使用し、同じ`:report_save`イベントと`'report.save'`イベントを発行する。これは両方とも本質的に「レポートの保存」操作であり、作成と更新を区別する必要がないためである。
⏰ 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 (1)
test/system/external_entries_test.rb (1)

26-30: 「+日報作成」非表示の回帰テスト追加は妥当(LGTM)

External Entries 上で「日報作成」を出さない仕様に対する回帰テストとして適切です。テスト名も英語化されており、ガイドライン準拠です。

@sharoa119
Copy link
Copy Markdown
Contributor Author

@komagata さん
お疲れ様です。
Node18になっていたのでpackage.jsonに合わせて20に変更しました。 そうしたら、テストは通るようになりましたが、デフォルトでも安定して通るように少し修正を入れました。
よろしくお願いいたします🙇‍♀️

Comment on lines -4 to -6
namespace :reports do
resources :unchecked, only: %i(index)
end
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.

未チェックの日報のページ自体なくなってしまって良かったんでしたっけ?

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.

コメントありがとうございます。
確認します!!

@sharoa119
Copy link
Copy Markdown
Contributor Author

@machida さん
お疲れ様です。
駒形さんから

未チェックの日報のページ自体なくなってしまって良かったんでしたっけ?

とコメントをいただきました。

私の理解では、未チェックタブ自体はなくなって、日報タブの中に「全て」と「未チェック」のサブタブがあるイメージです。
なので reports 内で「全て」と「未チェック」のタブを作って、index ファイル内で切り替えるように対応をしていました。
そして不要になった未チェック関連のコードは削除しています。

この方向で大丈夫だったのでしょうか。ご教示いただければと思います🙇‍♀️

@machida
Copy link
Copy Markdown
Member

machida commented Aug 27, 2025

@sharoa119 はい!それで大丈夫なはずなのですが、念のため再度このブランチを僕も確認したいと思います。

確認するので、少々お待ちください🙏

@machida
Copy link
Copy Markdown
Member

machida commented Aug 27, 2025

@sharoa119

なるほど、わかりました。サブタブなので未チェック一覧をパラメータで表示するように変更してくれたのですね!
今回のIssueではUIの変更だけでURLの変更までは考えていませんでした。
URLを変更するかどうかについてIssueで触れれば良かったのですが、全く思いついてませんでした🙇‍♂️
でも、機能としては問題ないので、あとはシステム的にどうかをkomagataさんに判断してもらいたいと思います。

@komagata

元々未チェックの日報一覧のURLが、
https://bootcamp.fjord.jp/reports/unchecked
だったのですが、

このPRで
http://localhost:3000/reports?unchecked=true
に変わりました。

URLが変わっただけで、機能や動作には問題ありませんでした。
URLが変わることはこのIssueでは意図していなかったのですが、使い勝手としては問題はありません。
あとはシステム的にどうかの判断をお願いします🙏

@sharoa119
Copy link
Copy Markdown
Contributor Author

@machida さん
コメントありがとうございます。

今回のIssueではUIの変更だけでURLの変更までは考えていませんでした。
URLを変更するかどうかについてIssueで触れれば良かったのですが、全く思いついてませんでした🙇‍♂️

いえいえ、私が確認すればよかったという話です😫
こちらこそ、すみません。以後気をつけます😞

駒形さんからの返信を待ちたいと思います。

@komagata
Copy link
Copy Markdown
Member

@machida

このPRで
http://localhost:3000/reports?unchecked=true
に変わりました。

なるほどです。ご説明ありがとうございます〜

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 805be01 into main Aug 27, 2025
16 checks passed
@komagata komagata deleted the feature/change_place_of_report_and_blog_tabs branch August 27, 2025 12:07
@github-actions github-actions bot mentioned this pull request Aug 27, 2025
24 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