Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 Walkthrough概要学習連続記録(study streak)の表示/非表示をユーザーが切り替えられるようにする機能を追加します。新しいデータベースカラム、ビューコンポーネント、コントローラアクション、検証、およびルーティングが含まれます。 変更内容
🎯 3 (Moderate) | ⏱️ ~20 分関連する可能性のあるプルリクエスト
推奨レビュアー
詩
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
9aebdeb to
84a7dee
Compare
84a7dee to
a539c55
Compare
🚀 Review AppURL: https://bootcamp-pr-9820-fvlfu45apq-an.a.run.app
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/components/study_streak/toggle_component.html.slim`:
- Line 33: In the toggle_component.html.slim template
(study_streak/toggle_component.html.slim) fix the Japanese typo by replacing the
string "ダッシュボート" with the correct "ダッシュボード" so the sentence reads
「学習連続記録はプロフィールとダッシュボードに表示され、他のユーザーからも閲覧されます。」; update only that literal in the
view template to correct the display text.
In `@app/controllers/users_controller.rb`:
- Around line 87-91: 現在の toggle_show_study_streak アクションは
current_user.toggle_show_study_streak! による反転更新で、再送や二重送信で状態がずれるため冪等ではありません。params
で明示的な状態(例: params[:show_study_streak] が "true"/"false")を受け取り、toggle ではなく
current_user.update!(show_study_streak: parsed_value)
のように明示的に更新するロジックに変更してください(パラメータのパース/バリデーションを行い、必要なら nil
の場合は既存の動作を維持)。redirect_to の部分(url_from(params[:redirect_to]) ||
root_path)はそのまま保持してください。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a5b978de-5066-4286-bbfc-e6200b56491c
⛔ Files ignored due to path filters (1)
app/assets/images/study_streak/about-study-streak.jpgis excluded by!**/*.jpg
📒 Files selected for processing (10)
app/components/study_streak/toggle_component.html.slimapp/components/study_streak/toggle_component.rbapp/controllers/users_controller.rbapp/models/user.rbapp/views/home/index.html.slimapp/views/users/show.html.slimconfig/locales/ja.ymlconfig/routes/users.rbdb/migrate/20260323020435_add_show_study_streak_to_users.rbdb/schema.rb
91459b4 to
29067e4
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
test/system/users_test.rb (1)
73-74: 2回目のトグル後のアサーションが不足しています。Line 73 で2回目のクリックを行っていますが、その後の状態を検証していません。トグルが元の状態に戻ることを確認するアサーションを追加することを推奨します。
♻️ 修正案
assert find('#toggle', visible: false).checked? find('label.a-on-off-checkbox').click + + assert_equal before, user.reload.show_study_streak + assert_no_selector 'div.a-card.streak-card' + assert_not find('#toggle', visible: false).checked? end🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/system/users_test.rb` around lines 73 - 74, The test in test/system/users_test.rb clicks the toggle twice using find('label.a-on-off-checkbox').click but lacks an assertion after the second click; add an assertion after the second click that verifies the toggle returned to its original state (for example by asserting the checkbox/input associated with 'label.a-on-off-checkbox' has the original checked/unchecked value or the UI shows the original state), placing the assertion immediately after the second find('label.a-on-off-checkbox').click to validate the toggle behavior.test/system/home_test.rb (1)
68-69: 2回目のトグル後のアサーションが不足しています。
users_test.rbと同様に、2回目のクリック後の状態検証がありません。♻️ 修正案
assert find('#toggle', visible: false).checked? find('label.a-on-off-checkbox').click + + assert_equal before, user.reload.show_study_streak + assert_no_selector 'div.a-card.streak-card' + assert_not find('#toggle', visible: false).checked? end🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/system/home_test.rb` around lines 68 - 69, home_test.rb is missing an assertion after the second toggle click; replicate the pattern used in users_test.rb by performing the second click on the same element (find('label.a-on-off-checkbox').click) and then asserting the expected post-toggle state (e.g., checkbox checked/unchecked or related DOM text/state) using the same helper/assertion used in users_test.rb so the test verifies both toggle transitions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@test/system/home_test.rb`:
- Around line 68-69: home_test.rb is missing an assertion after the second
toggle click; replicate the pattern used in users_test.rb by performing the
second click on the same element (find('label.a-on-off-checkbox').click) and
then asserting the expected post-toggle state (e.g., checkbox checked/unchecked
or related DOM text/state) using the same helper/assertion used in users_test.rb
so the test verifies both toggle transitions.
In `@test/system/users_test.rb`:
- Around line 73-74: The test in test/system/users_test.rb clicks the toggle
twice using find('label.a-on-off-checkbox').click but lacks an assertion after
the second click; add an assertion after the second click that verifies the
toggle returned to its original state (for example by asserting the
checkbox/input associated with 'label.a-on-off-checkbox' has the original
checked/unchecked value or the UI shows the original state), placing the
assertion immediately after the second find('label.a-on-off-checkbox').click to
validate the toggle behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 20d7be23-4cba-40d3-ae4c-64a939e1a038
⛔ Files ignored due to path filters (1)
app/assets/images/study_streak/about-study-streak.jpgis excluded by!**/*.jpg
📒 Files selected for processing (12)
app/components/study_streak/toggle_component.html.slimapp/components/study_streak/toggle_component.rbapp/controllers/users_controller.rbapp/models/user.rbapp/views/home/index.html.slimapp/views/users/show.html.slimconfig/locales/ja.ymlconfig/routes/users.rbdb/migrate/20260323020435_add_show_study_streak_to_users.rbdb/schema.rbtest/system/home_test.rbtest/system/users_test.rb
✅ Files skipped from review due to trivial changes (5)
- config/locales/ja.yml
- config/routes/users.rb
- app/components/study_streak/toggle_component.rb
- db/migrate/20260323020435_add_show_study_streak_to_users.rb
- app/components/study_streak/toggle_component.html.slim
🚧 Files skipped from review as they are similar to previous changes (3)
- app/models/user.rb
- app/views/home/index.html.slim
- db/schema.rb
|
デザイン入れましたー 変更の概要
|
02f54ad to
a0af7a6
Compare
a0af7a6 to
1d57c72
Compare
|
@Miya096jp |
|
@y-kawahara-gs |
|
@djkazunoko |
|
@y-kawahara-gs |
Issue
概要
変更確認方法
feature/add-function-to-toggle-display-of-continuous-learning-streak-on-or-offをローカルに取り込むScreenshot
変更前
変更後
Summary by CodeRabbit
リリースノート
新機能
テスト