Skip to content

Product.unchecked_no_replied_productsが未チェックかつ他者のコメントがない提出物を参照するように修正#8999

Merged
komagata merged 7 commits intomainfrom
bug/do-not-include-checked-products
Aug 22, 2025
Merged

Product.unchecked_no_replied_productsが未チェックかつ他者のコメントがない提出物を参照するように修正#8999
komagata merged 7 commits intomainfrom
bug/do-not-include-checked-products

Conversation

@thmz337
Copy link
Copy Markdown
Contributor

@thmz337 thmz337 commented Jul 30, 2025

Issue

概要

Product.unchecked_no_replied_productsについて、本来期待する動作になるよう修正を行いました。

何に使用するメソッドであるか

メンター・管理者が、提出物の内、合格判定を行っていないかつ(提出者以外の)コメントがない物を分かるようにするためのメソッド。

期待する動作

上記の通り、提出物の内、合格判定を行っていないかつ(提出者以外の)コメントがない物を抽出すること。

現在の動作

期待する動作の内、合格判定を行っていないという条件が満たされていないため、合格判定が行われている(checked)な提出物も抽出されてしまう。

今回行った修正

提出物を抽出する際の条件に、合格判定を行っていないを加えました。

変更確認方法

  1. bug/do-not-include-checked-productsをローカルに取り込む
  2. rails test test/models/product_test.rbを実行し、テストが通ることを確認する。
  3. foreman start -f Procfile.devでサーバーを起動
  4. 任意のユーザーで提出物を作成し、その提出物に提出物を作成したユーザーでコメントを残す
  5. 別の提出物も作成し、管理者等でチェック済みにする
  6. ターミナルでrails cを入力し、コンソールを起動する
  7. Product.unchecked_no_replied_productsを実行し、4の提出物が含まれていることを確認する
  8. Product.unchecked_no_replied_productsを実行し、5の提出物が含まれていないことを確認する

Summary by CodeRabbit

  • バグ修正

    • 未確認かつ未返信の商品抽出ロジックを調整し、自己返信のみの項目を含め、確認済みや他者返信のある商品を除外するよう改善しました。
  • テスト

    • 上記挙動を検証する単体テストを追加しました。
    • 統合テストの期待順序を更新しました。
  • テストデータ

    • テスト用データにメンター関連の時刻情報と表示ヘッダーの調整を追加し、再現性を高めました。

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jul 30, 2025

Walkthrough

Product.unchecked_no_replied_products スコープの内部実装が変更され、算出した未返信の ID 集合に対して unchecked スコープを適用して絞り込むようになった。対応するモデルテストが追加され、複数 fixtures にタイムスタンプが追加・更新された。API 結果順の統合テスト期待順も一箇所更新された。

Changes

Cohort / File(s) Change Summary
Productモデルのスコープ修正
app/models/product.rb
unchecked_no_replied_products を修正。ID 集合に対して直接 where するのではなく unchecked.where(id: no_replied_products_ids) を適用するように変更。並び順は published_at: :asc, id: :asc のまま。
スコープのテスト追加
test/models/product_test.rb
.unchecked_no_replied_products のテストを追加。複数の fixtures を用い、自己返信のみを含め他者返信やチェック済を除外することを検証。
テスト fixture 更新
test/fixtures/products.yml
複数の fixture に commented_atmentor_last_commented_at のタイムスタンプを追加・更新し、いくつかのヘッダ文言をメンター関与を明示する形で更新。
統合テスト期待順変更
test/integration/api/products_test.rb
"should return products in order" テストの期待順序を (product15, product63, product62, product64) から (product15, product62, product64, product63) に更新。

Sequence Diagram(s)

sequenceDiagram
  rect rgb(240,248,255)
  participant Test as TestSuite
  participant Product as ProductModel
  participant DB
  end

  Test->>Product: Product.unchecked_no_replied_products
  Product->>DB: SELECT ids for no_replied_products (self_last_commented + no_comments)
  Product->>DB: SELECT ids FROM unchecked scope
  Product->>Product: intersect IDs (no_replied_products_ids ∩ unchecked_ids)
  Product->>DB: SELECT * WHERE id IN (intersection) ORDER BY published_at ASC, id ASC
  Product-->>Test: ActiveRecord::Relation (結果)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

Suggested reviewers

  • Miya096jp
  • komagata

Poem

🐇
未返信の草むらで小さく跳ねて、IDを拾い集めたよ。
チェックの網をくぐり抜けて、順番に並んだ小道具たち。
テストがぽん、と頷けば僕はぴょんと去る。

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)
app/models/product.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

'

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.


📜 Recent review details

Configuration used: .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 ec66fe4 and be62c98.

📒 Files selected for processing (1)
  • app/models/product.rb (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/models/product.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
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bug/do-not-include-checked-products

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.

@thmz337 thmz337 self-assigned this Jul 30, 2025
@thmz337 thmz337 changed the title 未チェックかつ、自分以外のコメントがない提出物を取得するように修正 Product.unchecked_no_replied_productsが未チェックかつ他者のコメントがない提出物を参照するように修正 Jul 31, 2025
@thmz337 thmz337 marked this pull request as ready for review July 31, 2025 13:45
@github-actions github-actions bot requested a review from komagata July 31, 2025 13:45
@thmz337 thmz337 requested a review from matuaya July 31, 2025 13:46
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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c868887 and 1dd7573.

📒 Files selected for processing (2)
  • app/models/product.rb (1 hunks)
  • test/models/product_test.rb (1 hunks)
🧰 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/models/product_test.rb
  • app/models/product.rb
test/**/*

⚙️ CodeRabbit Configuration File

test/**/*: # Test

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

Unit Test

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

Files:

  • test/models/product_test.rb
🧠 Learnings (1)
📓 Common learnings
Learnt from: ryufuta
PR: fjordllc/bootcamp#8992
File: app/models/correct_answer_notifier.rb:23-23
Timestamp: 2025-07-30T07:26:36.599Z
Learning: PRのスコープを維持することが重要であり、バグ修正PRにおいて、修正対象以外の機能(例:ルーティングテスト)の追加提案は適切ではない。そのような改善が必要な場合は別PRで対応すべきである。
Learnt from: kitarou888
PR: fjordllc/bootcamp#8277
File: test/models/searcher_test.rb:326-331
Timestamp: 2025-07-10T12:59:27.807Z
Learning: モデルテストにおいて、1つのクラスメソッドの複数の挙動を検証する場合、機能の異なる側面を同じテストメソッドでテストすることは、包括的なテストとして適切である。特に`only_me`のような機能では、異なる検索条件(空文字と具体的な検索語)を使い分けることで、より広範囲な動作保証が可能となる。
Learnt from: masyuko0222
PR: fjordllc/bootcamp#8277
File: test/models/searcher_test.rb:0-0
Timestamp: 2025-07-07T12:46:01.650Z
Learning: テストにおいて、`result.all? { |condition| }` でコレクションの全要素が条件を満たすことを確認できれば、その条件を満たさない要素が含まれていないことも論理的に保証されるため、追加のアサーションは冗長となる。
Learnt from: thmz337
PR: fjordllc/bootcamp#8590
File: app/models/movie.rb:22-24
Timestamp: 2025-07-12T09:56:13.360Z
Learning: Rails scopeでnilやfalseを返すと、NoMethodErrorは発生せず、代わりにModel.allが返される。これによりメソッドチェインは継続するが、全レコードが読み込まれるため意図しない動作となる可能性がある。
Learnt from: reckyy
PR: fjordllc/bootcamp#8356
File: app/models/notification.rb:45-47
Timestamp: 2025-07-15T12:58:02.735Z
Learning: fjordllc/bootcampプロジェクトの`app/models/notification.rb`において、`training_completed`通知種別は`TARGETS_TO_KINDS`ハッシュに含めない設計になっている。これは`training_completed`が通知一覧のフィルタ対象ではないためで、意図的な設計判断である。
🔇 Additional comments (1)
app/models/product.rb (1)

64-66: 適切な修正です!

unchecked_no_replied_productsスコープが正しく修正されています。未チェックの提出物のIDと他者からのコメントがない提出物のIDの積集合を取ることで、両方の条件を満たす提出物のみを確実に返すようになりました。この実装により、PRの目的である「未チェックかつ他者のコメントがない提出物を参照する」が正確に実現されています。

Comment on lines +203 to +215
test '.unchecked_no_replied_products' do
unchecked_no_replied_products = Product.unchecked_no_replied_products

only_self_replied_product = products(:product1)
checked_product = products(:product2)
unchecked_replied_product = products(:product3)

assert_includes unchecked_no_replied_products, only_self_replied_product
assert_not_includes unchecked_no_replied_products, checked_product
assert_not_includes unchecked_no_replied_products, unchecked_replied_product
end
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

適切なテスト実装です!

新しく追加された.unchecked_no_replied_productsのテストケースは、修正されたスコープの動作を適切に検証しています。テスト名が英語で記述されており、コーディングガイドラインに従っています。

テストでは以下の3つのシナリオを検証しており、包括的です:

  • 自分のコメントのみの未チェック提出物(含まれるべき)
  • チェック済み提出物(除外されるべき)
  • 他者からのコメントがある未チェック提出物(除外されるべき)

フィクスチャデータが各テストケースの前提条件と一致していることを確認してください。

フィクスチャデータを確認するために以下のスクリプトを実行してください:


🏁 Script executed:

#!/bin/bash
# Description: Verify fixture data matches test assumptions for products used in the test

echo "Checking fixture data for products used in unchecked_no_replied_products test..."

# Check product1 (should be unchecked with only self-replies)
echo "=== Product1 (only_self_replied_product) ==="
rg -A 10 -B 2 "product1:" test/fixtures/products.yml

# Check product2 (should be checked)  
echo "=== Product2 (checked_product) ==="
rg -A 10 -B 2 "product2:" test/fixtures/products.yml

# Check product3 (should be unchecked with replies from others)
echo "=== Product3 (unchecked_replied_product) ==="
rg -A 10 -B 2 "product3:" test/fixtures/products.yml

# Also check for any related comments or checks
echo "=== Related comments ==="
rg "product[1-3]" test/fixtures/comments.yml | head -20

echo "=== Related checks ==="
rg "product[1-3]" test/fixtures/checks.yml | head -20

Length of output: 1980


.unchecked_no_replied_productsテストのフィクスチャ要修正

以下の点を修正してください:

  • test/fixtures/products.yml
    • product3 に現在 checker_id: "<%= ActiveRecord::FixtureSet.identify(:komagata) %>" が設定されており、未チェック前提(unchecked_replied_product)と矛盾しています。
      checker_id: nil に書き換え、未チェック状態としてください。
  • test/fixtures/comments.yml
    • product3 へのコメントが他ユーザーによるもの(user: …product3.user と異なる)であることを再確認してください。

これらを修正後、改めてテストが以下のシナリオを正しく検証できることを確認してください:

  • 自分のみのコメントあり & 未チェック → 含まれる
  • チェック済み → 含まれない
  • 他者コメントあり & 未チェック → 含まれない
🤖 Prompt for AI Agents
In test/models/product_test.rb around lines 203 to 213, the test for
`.unchecked_no_replied_products` relies on fixture data that is inconsistent.
Update test/fixtures/products.yml by changing `product3`'s `checker_id` to nil
to reflect an unchecked state. Then verify in test/fixtures/comments.yml that
comments on `product3` are from users different from `product3.user` to
represent replies from others. After these fixture corrections, rerun the test
to ensure it correctly verifies the intended scenarios.

@thmz337 thmz337 force-pushed the bug/do-not-include-checked-products branch from 1dd7573 to 9736a10 Compare July 31, 2025 15:38
@thmz337 thmz337 removed the request for review from matuaya August 4, 2025 13:55
@thmz337
Copy link
Copy Markdown
Contributor Author

thmz337 commented Aug 4, 2025

@Miya096jp

お疲れ様です。こちらレビューをお願いできないでしょうか?

@thmz337 thmz337 requested a review from Miya096jp August 4, 2025 13:58
@Miya096jp
Copy link
Copy Markdown
Contributor

@thmz337

お疲れ様です、依頼ありがとうございます!
対応できます🙆🏻‍♂️

@thmz337
Copy link
Copy Markdown
Contributor Author

thmz337 commented Aug 5, 2025

@Miya096jp

ありがとうございます!よろしくお願いします🙇

@Miya096jp
Copy link
Copy Markdown
Contributor

@thmz337

お疲れ様です!
2点質問させてください。

概要について

本来あるべき姿

本来であれば、未チェックかつ他者のコメントがない提出物を参照するメソッド

生じているバグ

現在は未チェックの箇所を満たせていません。

質問1

「チェック済み/未チェックに関わらず、コメントがない提出物をすべて抽出してしまう」という解釈でいいですか?

変更確認方法について

  1. 任意のユーザーで提出物を作成し、その提出物に自らコメントを残す
  2. 別の提出物も作成し、管理者等でチェック済みにする
    => これは含まれていないことを確認

手順4に対して、手順7で「4の提出物が含まれていることを確認する」とありますが、4の提出物は、「未チェックかつコメントあり」なので、抽出されないのではないかと思います(実際やってみたら抽出されなかった)

手順5に対して、手順8で「5の提出物が含まれていないことを確認する」とありますが、5の提出は「コメントなしかつチェック済み」なのでバグが修正されていれば、含まれていないで正しいと思います。(こちらは抽出された)

質問2

手順4は誤りでしょうか?

もしDiscriptionに誤りがあれば修正をお願いします。私が理解できていない部分があれば教えて頂けたらと思います。よろしくお願いします!

@thmz337
Copy link
Copy Markdown
Contributor Author

thmz337 commented Aug 8, 2025

@Miya096jp

お疲れ様です!ご確認ありがとうございます。

「チェック済み/未チェックに関わらず、コメントがない提出物をすべて抽出してしまう」という解釈でいいですか?

おっしゃる通りです。本来は、未チェック(合格になっていない)かつ(自分以外の)コメントがない提出物を抽出する物ですが、現状は未チェック(合格になっていない)の条件がメソッドにないため、チェック済み/未チェックに関わらず抽出してしまいます。

手順4に対して、手順7で「4の提出物が含まれていることを確認する」とありますが、4の提出物は、「未チェックかつコメントあり」なので、抽出されないのではないかと思います(実際やってみたら抽出されなかった)

こちら私の方でもやってみたのですが、抽出されるようです。提出物に付けたコメントは、その提出物を作成したユーザー自身のコメントでしょうか?任意のユーザーで提出物を作成し、その提出物に自らコメントを残す自らは、その提出物を作成したユーザー自身になります。分かりづらい書き方になってしまい申し訳ないです。

手順5に対して、手順8で「5の提出物が含まれていないことを確認する」とありますが、5の提出は「コメントなしかつチェック済み」なのでバグが修正されていれば、含まれていないで正しいと思います。(こちらは抽出された)

こちら私の方で5の手順を行ったところ、8で抽出されませんでした。チェックと言う書き方が良くなかったかもしれません。チェック=合格となります。提出物を合格にするを押して、ご確認いただけないでしょうか?

変更確認方法も変更させていただきます。
以上よろしくお願いいたします。

@Miya096jp
Copy link
Copy Markdown
Contributor

@thmz337

ありがとうございます!
あべこべになっていました、私の環境でも挙動は同じでした、申し訳ありません💦

その上で、Discriptionを見て、「この変更手順であっているのかな?」とモヤり、そのモヤりの原因を言語化できずにさらにモヤっていたのですが、やっと整理できたのでお伝えします。


まず、概要を見て、コメント判定は問題ない前提と理解しました。その上で、手順4の未チェック + 自分コメ = 参照されるのパターンを見て違和感を感じました(チェックを検証するならコメントなしに固定して十分と考えたため)

実装を見た後に、「自分コメは他者コメに含まない」ケースを回帰的にカバーする意図とわかり、手順4は適切だと理解しました。


モヤった原因

概要のメソッドの説明文、未チェック(合格でない)かつ他者のコメントがない提出物を参照するメソッドが抽象的で、メソッドの利用意図を推察する+頭の中で場合分けを行わなければならず、初見で変更確認手順と結びつけられなかったことが原因だと思います。

例えば、「メンター・管理者が、未チェックの提出物のうち、 "メンター・管理者のコメントがない" / "提出者のコメントに返信していない"ものがわかるようにするためのメソッド」など、「誰が」「いつ」「何のために」使うメソッドなのか具体的にわかるような書き方であればストンと腑に落ちたように思いました。

あとちょっとでレビュー終わりますので、もう少しお待ちください!

Copy link
Copy Markdown
Contributor

@Miya096jp Miya096jp left a comment

Choose a reason for hiding this comment

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

@thmz337

コメントしました!

created_at: <%= 9.day.ago %>
updated_at: <%= 9.day.ago %>
published_at: <%= 9.day.ago %>
commented_at: <%= 9.day.ago %>
Copy link
Copy Markdown
Contributor

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

@thmz337 thmz337 Aug 10, 2025

Choose a reason for hiding this comment

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

@Miya096jp

ご確認ありがとうございます。
提出者以外のコメントがないと言う条件で提出物を抽出するということを、以下を組み合わせることで行っています。

  1. 提出者はコメントしているが、管理者・メンターからのコメントがない
  2. そもそも誰もコメントしていない

2については、commented_atがnilであることによって判定するようにしています。
product10については、他者からのコメントがある提出物であるので、commented_atに値が入っていなければなりません。
そうでなければ2の条件に合致してしまい抽出されることになってしまいます。

不明な点、誤りがあればご指摘のほどよろしくお願いいたします🙇‍♀️

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ご回答ありがとうございます!
また少し疑問が出てきてしまったので、教えてください🙏

product10については、他者からのコメントがある提出物であるので、commented_atに値が入っていなければなりません

Commentableで紐づいているのになんでcreated_atがいるのかな?と思ったのですが、そもそもscopeでcreated_at = nilで判定してるということを忘れてました… ご教示ありがとうございます

2については、commented_atがnilであることによって判定するようにしています。

これはproduct2が、assert_notをパスすることをもって確認しているということでしょうか?

  1. 提出者はコメントしているが、管理者・メンターからのコメントがない

これはproduct1で行っているのでしょうか?もしそうであればproduct1にcreated_atが必要なように思いました。

Copy link
Copy Markdown
Contributor Author

@thmz337 thmz337 Aug 11, 2025

Choose a reason for hiding this comment

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

@Miya096jp

お疲れ様です。ご確認ありがとうございます。

これはproduct2が、assert_notをパスすることをもって確認しているということでしょうか?

created_atではなく、commented_atのことで良いでしょうか?
commented_atがnilであることによって判定するようにしています。と書いていますが、こちらのテストケースをカバーするテストがなかったため、追加させていただきました。

これはproduct1で行っているのでしょうか?もしそうであればproduct1にcreated_atが必要なように思いました。

こちらもcommented_atのことで良いでしょうか?おっしゃる通り、product1にcommented_atが必要です。修正させていただきました。

ご指摘ありがとうございました🙇‍♀️現在、テストが通らないため、webp周りの問題が解消され次第、改めてレビューのご依頼をさせていただきます。

以上よろしくお願いいたします。

Copy link
Copy Markdown
Contributor Author

@thmz337 thmz337 Aug 13, 2025

Choose a reason for hiding this comment

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

@Miya096jp

お疲れ様です!無事テストが通りましたので、レビューをお願いできますでしょうか。
以前の変更から、ご指摘事項(cdderabbitも含む)も踏まえて以下の箇所を変更しています。

  1. products.ymlの修正
    以前ご指摘いただいた点について、コメントがある提出物にcommented_atを追記させていただきました。その他のテストデータについても見直しを行い、整合性を取れるように修正しました。commentd_atを追記したことで、1件テストが通らなくなったため、そちらも合わせて修正を行っています。

  2. unchecked_no_replied_productsの修正
    修正前までは、

  • uncheckedな提出物のidとno_repliedな提出物のidを結合
  • 該当提出物を抽出

としていましたが、coderabbitの指摘を加味して、以下の通り変更を行いました。

  • uncheckedな提出物に対して、no_repliedな提出物のidで絞り込みを行う。

こうすることで、pluckメソッドによる、idの配列をメモリに展開することがなくなり、scope自体もスッキリしたと思います。

以上ご確認よろしくお願いいたします。

@thmz337 thmz337 force-pushed the bug/do-not-include-checked-products branch 2 times, most recently from 9bda333 to 9b88c06 Compare August 12, 2025 00:44
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

🔭 Outside diff range comments (2)
app/models/product.rb (2)

58-66: N+1/全件ロードを回避するため、DBで完結するクエリに置き換えましょう

現状の実装は以下の懸念があります:

  • where.not(...).filter により Ruby 側でレコードを全件走査
  • product.comments.last による N+1 クエリ(コメントを関連 preload していない)
  • 大量の pluck/map によるメモリ使用量増大
  • スコープ合成時にDB最適化が効きにくい

「他者から未返信」の判定は、既存のカラムである commented_at と self_last_commented_at を比較することでSQL上で行えます(「コメントなし」または「最後のコメントが提出者自身」)。以下のように置き換えることで、1クエリで完結し、N+1 と全件ロードを解消できます。

-  scope :unchecked_no_replied_products, lambda {
-    self_last_commented_products = where.not(commented_at: nil).filter do |product|
-      product.comments.last.user_id == product.user.id
-    end
-    no_comments_products = where(commented_at: nil)
-    no_replied_products_ids = (self_last_commented_products + no_comments_products).map(&:id)
-    unchecked_products_ids = unchecked.pluck(:id)
-    unchecked_no_replied_ids = no_replied_products_ids & unchecked_products_ids
-    where(id: unchecked_no_replied_ids).order(published_at: :asc, id: :asc)
-  }
+  scope :unchecked_no_replied_products, lambda {
+    unchecked
+      .where('commented_at IS NULL OR commented_at = self_last_commented_at')
+      .ascending_by_date_of_publishing_and_id
+  }

補足:

  • もし古いデータで self_last_commented_at が未設定の可能性がある場合は、移行時にバックフィルするか、暫定的に last_comments サブクエリで最終コメントの投稿者を判定する実装にすることも検討可能です(既存の self_assigned_no_replied_product_ids の CTE を参考にできます)。

58-63: 最後のコメント判定に comments.last は使わない方が安全

comments.last はデフォルト順序に依存し、最新コメント(updated_at)の保証がありません。アプリは commented_at を最新コメントの updated_at に同期しているため、commented_at = self_last_commented_at による判定の方が堅牢です(時系列の逆転や ORDER 指定漏れの影響を排除できます)。上記のリファクタでこの懸念は解消されます。

🧹 Nitpick comments (1)
app/models/product.rb (1)

41-41: unchecked スコープの pluck を避け、サブクエリ/結合で表現しませんか

現状の実装は pluck により全件を配列化してから NOT IN するため、件数が多いとメモリ負荷・SQL 長大化の懸念があります。checks の関連が既にあるため、以下のように書き換えると効率的で読みやすくなります。

- scope :unchecked, -> { where.not(id: Check.where(checkable_type: 'Product').pluck(:checkable_id)) }
+ scope :unchecked, -> { where.missing(:checks) }

Rails 6.1+ で where.missing(:association) が利用可能です。等価で、DB側で最適化されやすいです。

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9bda333 and 9b88c06.

📒 Files selected for processing (3)
  • app/models/product.rb (1 hunks)
  • test/fixtures/products.yml (2 hunks)
  • test/models/product_test.rb (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/models/product_test.rb
  • test/fixtures/products.yml
🧰 Additional context used
📓 Path-based instructions (1)
**/*.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/models/product.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 (1)
app/models/product.rb (1)

64-66: 未チェック条件の追加は妥当(ロジック修正OK)

no_replied_products_ids と unchecked_products_ids の積集合で絞り込むことで、「未チェック」かつ「他者から未返信」の要件が満たされています。最終クエリで order(published_at: :asc, id: :asc) している点も要件に整合しています。

@thmz337
Copy link
Copy Markdown
Contributor Author

thmz337 commented Aug 12, 2025

@coderabbitai

こちらの修正を適用すると、あるメンターが提出物を提出して、そのメンター自身が提出物にコメントをした際、self_last_commented_atが設定されないため、抽出を行うことができません。

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 12, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, let's look at the current implementation of the unchecked_no_replied_products method
cat app/models/product.rb | grep -A 20 "unchecked_no_replied_products"

Length of output: 975


🏁 Script executed:

#!/bin/bash
# Let's also look at how self_last_commented_at is used in the Product model
rg "self_last_commented_at" app/models/product.rb -A 3 -B 3

Length of output: 510


🏁 Script executed:

#!/bin/bash
# Let's examine the test file to better understand the expected behavior
cat test/models/product_test.rb | grep -A 15 -B 5 "unchecked_no_replied_products"

Length of output: 1311


🏁 Script executed:

#!/bin/bash
# Let's look for how self_last_commented_at is set or updated in the codebase
rg "self_last_commented_at.*=" --type rb -A 2 -B 2

Length of output: 79


🏁 Script executed:

#!/bin/bash
# Let's also check the fixtures to understand the test data structure
cat test/fixtures/products.yml | grep -A 10 -B 2 "self_last_commented_at\|commented_at"

Length of output: 681


🏁 Script executed:

#!/bin/bash
# Let's look for how self_last_commented_at is set, using a different approach
rg "self_last_commented_at" . -A 2 -B 2

Length of output: 6614


🏁 Script executed:

#!/bin/bash
# Let's examine the specific method that handles comment updates
cat app/models/product.rb | grep -A 10 -B 5 "update_commented_at"

Length of output: 740


🏁 Script executed:

#!/bin/bash
# Let's look at the fixtures more specifically for the products used in the test
cat test/fixtures/products.yml | grep -A 15 -B 5 "product1:\|product6:\|product10:"

Length of output: 1414


🏁 Script executed:

#!/bin/bash
# Let's also check if there are any mentor-related checks in the code
rg "mentor" app/models/product.rb -A 3 -B 3

Length of output: 550


🏁 Script executed:

#!/bin/bash
# Let's understand the User model and mentor role
rg "def mentor" app/models/user.rb -A 3 -B 3

Length of output: 46


🏁 Script executed:

#!/bin/bash
# Let's look for mentor method or property in the User model
rg "mentor" app/models/user.rb -A 2 -B 2

Length of output: 3283


🏁 Script executed:

#!/bin/bash
# Let's check the fixtures to see who mentormentaro is
cat test/fixtures/users.yml | grep -A 10 -B 5 "mentormentaro:"

Length of output: 608


🏁 Script executed:

#!/bin/bash
# Let's examine the current implementation more closely and look at the unchecked scope
cat app/models/product.rb | grep -A 10 -B 5 "scope.*unchecked"

Length of output: 1761


🏁 Script executed:

#!/bin/bash
# Let's look at the update_last_commented_at method more closely to understand the logic
cat app/models/product.rb | grep -A 15 -B 5 "update_last_commented_at"

Length of output: 1258


🏁 Script executed:

#!/bin/bash
# Let's see if there are any comments in the fixtures related to product1 that would help understand the scenario
cat test/fixtures/comments.yml | grep -A 10 -B 5 "product1\|product.*1"

Length of output: 1385


@thmz337 あなたの指摘は正しいです。これは重要な問題だと思います。

現在のupdate_last_commented_atメソッドのロジックを確認したところ、以下のような順序で処理されています:

def update_last_commented_at(comment)
  if comment
    if comment.user.mentor
      update_columns(mentor_last_commented_at: comment.updated_at)
    elsif comment.user == user
      update_columns(self_last_commented_at: comment.updated_at)
    end
  else
    update_columns(mentor_last_commented_at: nil, self_last_commented_at: nil)
  end
end

問題の原因:
メンターが自分の提出物にコメントした場合:

  • comment.user.mentortrue になる
  • comment.user == usertrue になる
  • しかし、if/elsif 構造のため、最初の条件(mentor)だけが実行される
  • その結果、mentor_last_commented_at は設定されるが、self_last_commented_at は設定されない

影響:
unchecked_no_replied_products スコープは self_last_commented_at フィールドには直接依存していませんが、以下のロジックを使用しています:

self_last_commented_products = where.not(commented_at: nil).filter do |product|
  product.comments.last.user_id == product.user.id
end

この場合は大丈夫そうですが、将来的に self_last_commented_at フィールドを使用する機能が追加された場合に問題が生じる可能性があります。

この問題を修正するには、メンターが自分の提出物にコメントした場合に両方のフィールドを適切に設定するか、優先順位を見直す必要があります。

@fjordllc fjordllc deleted a comment from coderabbitai bot Aug 12, 2025
@thmz337
Copy link
Copy Markdown
Contributor Author

thmz337 commented Aug 12, 2025

@coderabbitai

この点を踏まえて、unchecked_no_replied_productsの修正点はありますか?

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 12, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

@thmz337 現在のunchecked_no_replied_productsの実装を詳しく確認しましたが、修正点はありません

理由は以下の通りです:

現在の実装の動作

self_last_commented_products = where.not(commented_at: nil).filter do |product|
  product.comments.last.user_id == product.user.id
end

この部分では:

  • self_last_commented_atフィールドは使用していない
  • 代わりにproduct.comments.last.user_id == product.user.idで直接比較している

メンター自己コメントのケース

メンターが自分の提出物にコメントした場合:

  1. commented_atは設定される(コメントがあるため)
  2. product.comments.last.user_id == product.user.idtrueになる(コメント者と提出者が同じため)
  3. そのためself_last_commented_productsに正しく含まれる
  4. 提出物が未チェックであれば、最終的にunchecked_no_replied_productsに含まれる

結論

self_last_commented_atフィールドが設定されない問題はありますが、unchecked_no_replied_productsメソッドはそのフィールドに依存していないため、現在の実装で正しく動作します。

このメソッドに関しては追加の修正は不要です。


🏁 Script executed:

#!/bin/bash
# Let's examine the current implementation again to confirm the logic
cat app/models/product.rb | grep -A 25 "def self.unchecked_no_replied_products"

Length of output: 81


🏁 Script executed:

#!/bin/bash
# Let's search for the method more broadly
rg "unchecked_no_replied_products" app/models/product.rb -A 10 -B 5

Length of output: 1051


🏁 Script executed:

#!/bin/bash
# Let's also check if it's defined as a scope
rg "scope.*unchecked_no_replied_products" app/models/product.rb -A 15 -B 5

Length of output: 1194


🏁 Script executed:

#!/bin/bash
# Let's look at the entire Product model to find this method
cat app/models/product.rb | grep -n -A 15 -B 5 "unchecked_no_replied"

Length of output: 1504


@thmz337 実装を確認しました。unchecked_no_replied_productsに修正点はありません

現在の実装の詳細分析

scope :unchecked_no_replied_products, lambda {
  self_last_commented_products = where.not(commented_at: nil).filter do |product|
    product.comments.last.user_id == product.user.id
  end
  no_comments_products = where(commented_at: nil)
  no_replied_products_ids = (self_last_commented_products + no_comments_products).map(&:id)
  unchecked_products_ids = unchecked.pluck(:id)
  unchecked_no_replied_ids = no_replied_products_ids & unchecked_products_ids
  where(id: unchecked_no_replied_ids).order(published_at: :asc, id: :asc)
}

メンター自己コメントケースでの動作

メンターが自分の提出物にコメントした場合:

  1. commented_atは設定される → コメントが存在するため
  2. product.comments.last.user_id == product.user.idtrue → コメント者と提出者が同じメンターのため
  3. self_last_commented_productsに含まれる → 上記条件を満たすため
  4. no_replied_products_idsに含まれる → 自己コメントは「他者からの返信なし」として扱われる
  5. 未チェックなら最終結果に含まれるunchecked_products_idsとの積集合に含まれる

結論

この実装は:

  • self_last_commented_atフィールドに依存していない
  • 直接コメントテーブルから最新コメントの投稿者を確認している
  • メンター自己コメントケースでも正しく動作する

従って、unchecked_no_replied_productsメソッドに関しては現在の実装で問題なく、修正は不要です。

self_last_commented_atの設定問題は別の機能で将来的に影響する可能性がありますが、このメソッドには影響しません。

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

♻️ Duplicate comments (1)
test/fixtures/products.yml (1)

86-87: commented_at 付与の意図は過去コメントで解消済み

「他者コメントのある提出物に commented_at が必要」という点は、過去のやり取りで理由が説明されており納得です。現状の追記はその意図に沿っています。

🧹 Nitpick comments (3)
test/fixtures/products.yml (3)

1-7: 「自分のみコメント」ケースの表現として妥当/タイムスタンプ整合性は任意で補強を検討

  • product1 に mentor_last_commented_atcommented_at を付与したのは、提出者本人(今回はメンター)だけがコメントしているケースの再現として妥当です。
  • ただし、product1 は published_at が未設定のままなので、時系列の一貫性(「公開後にコメントが付く」)や ORDER BY published_at の安定性の観点では、任意で published_at/created_at/updated_atcommented_at より過去に揃えておくと安全です(NULL の並び順がDB依存で先頭に来るケースを避けられます)。

以下のように時系列を補強することを検討ください(任意):

 product1: # 自分(メンター)のコメントあり(2つ)
   practice: practice1
   user: mentormentaro
   body: テストの提出物1です。
   checker_id: nil
+  created_at: <%= 2.day.ago %>
+  updated_at: <%= 2.day.ago %>
+  published_at: <%= 2.day.ago %>
   mentor_last_commented_at: <%= 1.day.ago %>
   commented_at: <%= 1.day.ago %>

79-87: 見出し表現のゆれ(「のコメントあり」/「からのコメントあり」)の統一を提案

他のエントリ(例: product9, product67)は「からのコメントあり」を使っている一方、ここは「のコメントあり」になっています。検索や将来の読みやすさのために表現統一を提案します(挙動には影響しない軽微な指摘)。

-product10: # 他者(メンター)のコメントあり
+product10: # 他者(メンター)からのコメントあり

89-97: 見出し表現の統一(任意)

product10 同様、見出しの表現を統一しておくと読み手に優しいです。

-product11: # 他者(メンター)のコメントあり
+product11: # 他者(メンター)からのコメントあり
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9b88c06 and 27acfbc.

📒 Files selected for processing (2)
  • app/models/product.rb (1 hunks)
  • test/fixtures/products.yml (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/models/product.rb
🧰 Additional context used
📓 Path-based instructions (1)
test/**/*

⚙️ CodeRabbit Configuration File

test/**/*: # Test

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

Unit Test

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

Files:

  • test/fixtures/products.yml
⏰ 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)
test/fixtures/products.yml (4)

18-26: チェック済み+他者(メンター)コメントありの条件付けが明確で良いです

commented_atmentor_last_commented_at の付与により、「返信あり」扱いが明確になっています。unchecked_no_replied_products から除外されるべきデータとして整合的です。


69-77: LGTM: 「チェック済み+他者コメントあり」のデータ整備が適切

commented_at/mentor_last_commented_at の付与でスコープの意図どおり振る舞う状態が確保されています。


384-385: 担当+返信済みのケース明示として適切

product63commented_at/mentor_last_commented_at を追加したことで、「返信済み」条件がデータ上も明確になりました。関連テストの期待に合致しています。


407-413: LGTM: チェック済み+他者(メンター)コメントありの明示

checker_idcommented_at/mentor_last_commented_at の組み合わせで本データが対象スコープから外れることが明確です。問題ありません。

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 (3)
test/integration/api/products_test.rb (3)

62-64: self_assigned の並び順変更が仕様どおりかを要確認+根拠の明文化を

期待順の入れ替え自体は受け入れ可能ですが、このテストは self_assigned エンドポイントの順序保証を検証しています。今回のPRは unchecked_no_replied_products の修正が主目的のため、self_assigned の順序が「仕様として意図的に」変わったのか、あるいはフィクスチャ(commented_at/mentor_last_commented_at 等)の更新に伴う付随的な変化なのかを確認してください。後者であれば、テストの直上に「この順序が成り立つ根拠(ソートキー)」をコメントで明示しておくと将来の保守性が上がります。


62-64: タイトルではなくIDで順序を検証して脆さを低減

practice.title は文言変更の影響を受けやすいので、可能なら product ID ベースでの順序検証に切り替えることをおすすめします(API レスポンスに id が含まれている前提)。その場合は以下のように書き換えられます。

-    expected = products(:product15, :product62, :product64, :product63).map { |product| product.practice.title }
-    actual = response.parsed_body['products'].map { |product| product['practice']['title'] }
+    expected = [products(:product15).id, products(:product62).id, products(:product64).id, products(:product63).id]
+    actual = response.parsed_body['products'].map { |product| product['id'] }

57-57: テスト名の末尾スペースを削除

見落としや差分ノイズの原因になりがちなので、末尾スペースは削除しておきましょう。

-  test 'should return products in order ' do
+  test 'should return products in order' do
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 27acfbc and ec66fe4.

📒 Files selected for processing (1)
  • test/integration/api/products_test.rb (1 hunks)
🧰 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/integration/api/products_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/integration/api/products_test.rb
🧬 Code Graph Analysis (1)
test/integration/api/products_test.rb (1)
app/models/practice.rb (1)
  • product (139-141)
⏰ 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

Copy link
Copy Markdown
Contributor

@Miya096jp Miya096jp left a comment

Choose a reason for hiding this comment

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

@thmz337

お疲れ様です!

問題ないと思われるので、Approveとさせていただきます🙆🏻‍♂️

@thmz337
Copy link
Copy Markdown
Contributor Author

thmz337 commented Aug 15, 2025

@Miya096jp

お疲れ様です。ご確認ありがとうございました🙇

@komagata

こちらレビューをお願いできますでしょうか?
ご確認よろしくお願いいたします。

@thmz337 thmz337 force-pushed the bug/do-not-include-checked-products branch from ec66fe4 to be62c98 Compare August 21, 2025 13:25
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 173008a into main Aug 22, 2025
5 checks passed
@komagata komagata deleted the bug/do-not-include-checked-products branch August 22, 2025 06:37
@github-actions github-actions bot mentioned this pull request Aug 22, 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.

3 participants