Skip to content

日報の個別ページにそのユーザーの未チェックの日報数を表示した#8740

Merged
komagata merged 18 commits intomainfrom
feature/show-user-unchecked-report-count-only-mentor
Jul 29, 2025
Merged

日報の個別ページにそのユーザーの未チェックの日報数を表示した#8740
komagata merged 18 commits intomainfrom
feature/show-user-unchecked-report-count-only-mentor

Conversation

@hirokiej
Copy link
Copy Markdown
Contributor

@hirokiej hirokiej commented Jun 6, 2025

Issue

概要

メンターでログインしたとき、日報の個別ページにそのユーザーの未チェックの日報数を表示した

変更確認方法

  1. feature/show-user-unchecked-report-count-only-mentorをローカルに取り込む
git fetch origin feature/show-user-unchecked-report-count-only-mentor
git checkout feature/show-user-unchecked-report-count-only-mentor
  1. ユーザー名komagata、passwordtesttestでログインをする。
  2. 左上のメンターモードがオンであることを確認する。
  3. サイドバーの「日報・ブログ」をクリックし、未チェックの日報に飛ぶ。
  4. 以下の日報に移動し、日報本文下にそれぞれの文言を確認する。
    i.「MaruMaru Inc.の研修生のテスト日報14です」で「marumarushain14さんの未チェックの日報はこれで最後です。」という文言を確認し、「日報を確認」をクリック。
    ii.ページを更新し、「marumarushain14さんの日報へ」と変更されていることを確認する。
    iii.「 2日目 昨日よりできなかった 」で「hatsunoさんの未チェックの日報が3件あります。」の文言を確認する。
    IV.「 今日は頑張りました」で「hajimeさんの未チェックの日報が5件あります。」
    V.「 日報70 」で「with-hyphenさんの未チェックの日報が34件あります。」の文言を確認する。
    6.メンターモードをオフにして、表示が消えることを確認する。

Screenshot

変更前

image

変更後

image image image image image

Summary by CodeRabbit

  • 新機能

    • スタッフユーザー向けに、各ユーザーの未チェックレポート数をレポート詳細画面で表示する機能を追加しました。未チェックレポート数に応じて表示メッセージやボタンの色が変化します。
  • スタイル

    • レポートアクションやカード要素の新しいスタイルを追加・調整しました。
  • バグ修正

    • 未チェックレポート数のキャッシュがユーザーごとに適切にクリアされるよう改善しました。
  • テスト

    • レポート数による表示クラスやメッセージのテストを追加しました。

@hirokiej hirokiej self-assigned this Jun 6, 2025
@hirokiej hirokiej force-pushed the feature/show-user-unchecked-report-count-only-mentor branch from 3309a3e to 080d079 Compare June 6, 2025 16:38
@hirokiej
Copy link
Copy Markdown
Contributor Author

hirokiej commented Jun 8, 2025

@machida さん
お疲れ様です。
すみません、こちらにコメントすべきでした💦

キリの良いところまで実装しましたので、デザイン付をよろしくお願いいたします🙇
メンターモードONの時に未チェックの日報数を表示するようにしたのコミットにて仮のCSSで命名をして表示しております。
よろしくお願いいたします。

@hirokiej hirokiej force-pushed the feature/show-user-unchecked-report-count-only-mentor branch 2 times, most recently from 1fc50e8 to ccc04cb Compare June 9, 2025 02:50
@hirokiej hirokiej force-pushed the feature/show-user-unchecked-report-count-only-mentor branch from ccc04cb to 30a91bd Compare June 9, 2025 02:56
@hirokiej
Copy link
Copy Markdown
Contributor Author

hirokiej commented Jun 9, 2025

@machida さん
staff_login?かつ、メンターモードをオンにした時に未チェックの日報件数を表示するようにしました。
お手隙でデザイン付をよろしくお願いいたします🙇

残りの件数によって表示される文章はその後に実装いたします。
よろしくお願いいたします。

@machida
Copy link
Copy Markdown
Member

machida commented Jun 9, 2025

@hirokiej デザイン入れましたー 件数でデザインが変わるので注意してください🙏

@hirokiej
Copy link
Copy Markdown
Contributor Author

hirokiej commented Jun 9, 2025

@machida さん
ありがとうございます!
確認できました。
再度実装進めてまいります🙇

@machida
Copy link
Copy Markdown
Member

machida commented Jun 9, 2025

@hirokiej 確認ありがとうございます!よろしくお願いしますー

@hirokiej hirokiej force-pushed the feature/show-user-unchecked-report-count-only-mentor branch from e62a703 to bff43bc Compare June 28, 2025 14:26
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 28, 2025

"""

Walkthrough

ユーザーごとの未チェックレポート数のキャッシュ管理機能が追加され、それに伴いキャッシュの取得・削除メソッド、ActiveRecordスコープ、デコレーターモジュール、UI表示、スタイル、テストが拡張・新設されました。また、未チェックレポート数のキャッシュの整合性を保つため、関連するコールバックや通知処理も修正されています。

Changes

ファイル群 変更概要
app/models/cache.rb, app/models/report.rb ユーザーごとの未チェックレポート数取得・削除メソッド、ユーザースコープ追加
app/models/check_callbacks.rb, app/models/report_callbacks.rb, app/models/report_notifier.rb レポート関連キャッシュ削除にユーザー別キャッシュ削除処理を追加
app/views/reports/_report_body.html.slim スタッフ向けにユーザー未チェックレポート数とメッセージを表示するUIを追加
app/decorators/user_decorator.rb, app/decorators/user_decorator/report_status.rb ReportStatusモジュール新設・インクルード、判定ロジックとメッセージ生成を実装
test/decorators/user_decorator/report_status.rb ReportStatusモジュールのクラス判定・メッセージ生成テストを新設
app/javascript/stylesheets/application.sass, app/javascript/stylesheets/application/blocks/cards/_card-body-main-actions.sass 新しいSASSファイルのインポートと、カード用スタイルの追加
app/javascript/stylesheets/application/blocks/event/_event-main-actions.sass イベントメインアクションの色・フォントサイズ調整

Sequence Diagram(s)

sequenceDiagram
    participant StaffUser
    participant View
    participant Cache
    participant Report
    participant UserDecorator

    StaffUser->>View: レポート詳細ページを表示
    View->>Cache: user_unchecked_report_count(report.user)
    Cache->>Report: unchecked, not WIP, userスコープで件数取得
    Cache-->>View: 件数返却
    View->>UserDecorator: unchecked_report_message(件数, user)
    UserDecorator-->>View: メッセージ返却
    View-->>StaffUser: 件数とメッセージを表示
Loading
sequenceDiagram
    participant Report
    participant Callbacks
    participant Cache

    Report->>Callbacks: レポート削除/チェック作成・削除
    Callbacks->>Cache: delete_unchecked_report_count
    Callbacks->>Cache: delete_user_unchecked_report_count(user_id)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Suggested reviewers

  • kushimegu
  • komagata

Poem

レポート数を数えてピョンピョン跳ねる
スタッフうさぎはキャッシュに夢中
色とメッセージで分かる進捗
新しいSASSでカードもおしゃれ
テストも忘れず、ぴったり安心
今日も元気にレビューでジャンプ! 🐇✨
"""

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/decorators/user_decorator.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.77.0/lib/rubocop/config_loader_resolver.rb:309:in rescue in gem_config_path' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_loader_resolver.rb:293:in gem_config_path'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/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.77.0/lib/rubocop/config_loader_resolver.rb:82:in reverse_each'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_loader_resolver.rb:82:in block in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_loader_resolver.rb:76:in each_pair'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_loader_resolver.rb:76:in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_loader.rb:66:in load_file'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_store.rb:29:in options_config=' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/cli.rb:160:in act_on_options'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/cli.rb:47:in block in run' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/cli.rb:81:in profile_if_needed'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/cli.rb:43:in run' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/exe/rubocop:19:in <top (required)>'
/usr/local/bin/rubocop:25:in load' /usr/local/bin/rubocop:25:in

'

test/decorators/user_decorator/report_status.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.77.0/lib/rubocop/config_loader_resolver.rb:309:in rescue in gem_config_path' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_loader_resolver.rb:293:in gem_config_path'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/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.77.0/lib/rubocop/config_loader_resolver.rb:82:in reverse_each'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_loader_resolver.rb:82:in block in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_loader_resolver.rb:76:in each_pair'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_loader_resolver.rb:76:in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_loader.rb:66:in load_file'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_store.rb:29:in options_config=' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/cli.rb:160:in act_on_options'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/cli.rb:47:in block in run' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/cli.rb:81:in profile_if_needed'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/cli.rb:43:in run' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/exe/rubocop:19:in <top (required)>'
/usr/local/bin/rubocop:25:in load' /usr/local/bin/rubocop:25:in

'

app/decorators/user_decorator/report_status.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.77.0/lib/rubocop/config_loader_resolver.rb:309:in rescue in gem_config_path' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_loader_resolver.rb:293:in gem_config_path'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/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.77.0/lib/rubocop/config_loader_resolver.rb:82:in reverse_each'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_loader_resolver.rb:82:in block in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_loader_resolver.rb:76:in each_pair'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_loader_resolver.rb:76:in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_loader.rb:66:in load_file'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/config_store.rb:29:in options_config=' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/cli.rb:160:in act_on_options'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/cli.rb:47:in block in run' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/cli.rb:81:in profile_if_needed'
/var/lib/gems/3.1.0/gems/rubocop-1.77.0/lib/rubocop/cli.rb:43:in run' /var/lib/gems/3.1.0/gems/rubocop-1.77.0/exe/rubocop:19:in <top (required)>'
/usr/local/bin/rubocop:25:in load' /usr/local/bin/rubocop:25:in

'

  • 5 others

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ff0151c and 6f94e8b.

📒 Files selected for processing (12)
  • app/decorators/user_decorator.rb (1 hunks)
  • app/decorators/user_decorator/report_status.rb (1 hunks)
  • app/javascript/stylesheets/application.sass (1 hunks)
  • app/javascript/stylesheets/application/blocks/cards/_card-body-main-actions.sass (1 hunks)
  • app/javascript/stylesheets/application/blocks/event/_event-main-actions.sass (2 hunks)
  • app/models/cache.rb (1 hunks)
  • app/models/check_callbacks.rb (1 hunks)
  • app/models/report.rb (1 hunks)
  • app/models/report_callbacks.rb (1 hunks)
  • app/models/report_notifier.rb (1 hunks)
  • app/views/reports/_report_body.html.slim (1 hunks)
  • test/decorators/user_decorator/report_status.rb (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/decorators/user_decorator.rb
🚧 Files skipped from review as they are similar to previous changes (11)
  • app/models/report.rb
  • app/models/report_callbacks.rb
  • app/javascript/stylesheets/application.sass
  • app/models/check_callbacks.rb
  • app/models/report_notifier.rb
  • app/views/reports/_report_body.html.slim
  • test/decorators/user_decorator/report_status.rb
  • app/javascript/stylesheets/application/blocks/event/_event-main-actions.sass
  • app/decorators/user_decorator/report_status.rb
  • app/models/cache.rb
  • app/javascript/stylesheets/application/blocks/cards/_card-body-main-actions.sass
⏰ 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 feature/show-user-unchecked-report-count-only-mentor

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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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.

Documentation and Community

  • 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.

@hirokiej hirokiej force-pushed the feature/show-user-unchecked-report-count-only-mentor branch from bff43bc to b59205d Compare June 28, 2025 15:19
@hirokiej hirokiej marked this pull request as ready for review June 28, 2025 15:51
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 (2)
app/views/reports/_report_body.html.slim (2)

10-10: ビューでのキャッシュ呼び出しについて検討してください

ビューテンプレート内で直接 Cache.user_unchecked_report_count(report.user) を呼び出していますが、パフォーマンスの観点から、この処理をコントローラーで事前に実行し、インスタンス変数として渡すことを検討してください。

コントローラーで以下のように事前に取得することをお勧めします:

# コントローラー内で
+@unchecked_count = Cache.user_unchecked_report_count(@report.user) if staff_login?
# ビューで
-- count = Cache.user_unchecked_report_count(report.user)
+- count = @unchecked_count

17-18: リンクテキストの一貫性を確保

「#{report.user.login_name}さんの日報一覧へ」というリンクテキストが、メッセージ内容と重複している可能性があります。ユーザビリティの観点から、より簡潔な表現を検討してください。

以下のような簡潔な表現を検討してください:

-| #{report.user.login_name}さんの日報一覧へ
+| 日報一覧を見る
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8d28244 and b59205d.

📒 Files selected for processing (9)
  • app/helpers/reports_helper.rb (2 hunks)
  • app/javascript/stylesheets/application.sass (1 hunks)
  • app/javascript/stylesheets/application/blocks/cards/_card-body-main-actions.sass (1 hunks)
  • app/javascript/stylesheets/application/blocks/event/_event-main-actions.sass (2 hunks)
  • app/javascript/stylesheets/application/blocks/micro-report/_micro-report.sass (0 hunks)
  • app/models/cache.rb (1 hunks)
  • app/models/report.rb (1 hunks)
  • app/views/reports/_report_body.html.slim (1 hunks)
  • test/helpers/reports_helper_test.rb (1 hunks)
💤 Files with no reviewable changes (1)
  • app/javascript/stylesheets/application/blocks/micro-report/_micro-report.sass
🧰 Additional context used
🧠 Learnings (1)
app/views/reports/_report_body.html.slim (1)
Learnt from: tyrrell-IH
PR: fjordllc/bootcamp#8807
File: app/views/welcome/job_support.html.slim:391-392
Timestamp: 2025-06-21T22:30:20.116Z
Learning: このプロジェクトにはRailsの組み込みmarkdownヘルパが利用できないため、markdownのHTML変換には自前でヘルパを実装する必要がある。
🧬 Code Graph Analysis (1)
test/helpers/reports_helper_test.rb (1)
app/helpers/reports_helper.rb (2)
  • user_report_count_class (43-54)
  • unchecked_report_message (56-64)
🔇 Additional comments (14)
app/javascript/stylesheets/application.sass (1)

16-16: 新しいスタイルシートのインポートが適切に追加されています

カード関連のインポートと一緒にグループ化されており、既存のパターンに従っています。

app/models/report.rb (1)

62-62: ユーザーでのフィルタリングスコープが適切に実装されています

Railsの慣習に従い、シンプルで明確な実装になっています。既存のスコープパターンと一貫性があります。

app/javascript/stylesheets/application/blocks/event/_event-main-actions.sass (2)

18-19: イベントアクションの色調整が適切に行われています

未参加で参加可能な状態の背景色とテキスト色がより見やすく調整されています。


30-30: フォントサイズの調整で可読性が向上しています

わずかなサイズ増加により、説明文の可読性が改善されています。

test/helpers/reports_helper_test.rb (2)

18-30: レポート件数のCSSクラス分類のテストが包括的です

成功、プライマリ、警告、危険の各範囲をカバーしており、境界値のテストも含まれています。


32-37: 未チェックレポートメッセージのテストが適切です

0件、1件(最後)、複数件の各シナリオをテストしており、ユーザー名の組み込みも確認されています。

app/models/cache.rb (2)

15-19: ユーザー固有の未チェックレポート数キャッシュが適切に実装されています

既存のキャッシュメソッドパターンに従い、適切なスコープ組み合わせで実装されています。


21-23: レポートモデルのキャッシュ削除コールバックの配置確認
delete_user_unchecked_report_count メソッドがレポート作成・更新・削除時のコールバックとして登録されているか確認できませんでした。以下をご確認ください:

  • app/models/report.rb に以下のような登録があるか
    • after_create :delete_user_unchecked_report_count
    • after_update :delete_user_unchecked_report_count
    • after_destroy :delete_user_unchecked_report_count
app/views/reports/_report_body.html.slim (1)

11-11: CSSクラスの動的生成が適切に実装されています

ヘルパーメソッドを使用したCSSクラスの動的生成により、未チェック件数に応じた適切なスタイリングが実現されています。メンター専用表示の条件分岐も適切です。

app/javascript/stylesheets/application/blocks/cards/_card-body-main-actions.sass (2)

2-11: レスポンシブデザインの実装が適切です

メディアクエリを使用したレスポンシブデザインの実装が適切で、異なる画面サイズに対応したパディングとマージンの調整が行われています。


34-42: フレックスボックスレイアウトの実装が優秀です

アイテムの中央配置とレスポンシブな最大幅設定により、様々な画面サイズで適切な表示が実現されています。

app/helpers/reports_helper.rb (3)

4-8: 定数定義が明確で理解しやすいです

未チェック件数に基づく分類の定数定義が明確で、コードの可読性が高いです。無限範囲記法 (10..) の使用も適切です。


43-54: CSS クラスマッピングロジックが適切です

case文を使用したシンプルで明確なCSS クラスマッピングが実装されています。範囲オブジェクトを使用した条件分岐も理解しやすいです。


56-64: XSSリスクなし: login_name はバリデーションと自動エスケープで保護されています

  • User#login_name は以下のバリデーションでHTMLタグやスクリプト挿入を防止
    • 除外ルール(RESERVED_LOGIN_NAMES
    • 文字数制限(最小3文字)
    • 存在性・一意性
    • 形式制約(半角英数字とハイフンのみを許可)
  • Railsのビューでは返却された文字列はデフォルトでエスケープされるため、ヘルパーメソッド内での文字列補間でもXSSは発生しません

以上より、現状の実装で追加対応は不要です。

Comment on lines +12 to +27
&.is-success
background-color: #f8fff2
border: 1px solid var(--success)
color: var(--success-text)
&.is-primary
border: 1px solid var(--primary)
background-color: #f5f5ff
color: var(--primary-text)
&.is-warning
border: 1px solid var(--warning)
background-color: #fff9e7
color: var(--warning-text)
&.is-danger
border: 1px solid var(--danger)
background-color: var(--danger-tint)
color: var(--danger-text)
Copy link
Copy Markdown

@coderabbitai coderabbitai bot Jun 28, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

アクセシビリティの改善を検討してください

色のみでステータスを示すスタイリングは、色覚に障害のあるユーザーにとってアクセシブルではありません。アイコンやボーダースタイルなどの追加の視覚的手がかりを検討してください。

以下のような改善案を検討してください:

  &.is-success
    background-color: #f8fff2
    border: 1px solid var(--success)
    color: var(--success-text)
+   &::before
+     content: "✓"
+     margin-right: 0.5rem

同様に他の状態についても適切なアイコンやインジケーターを追加することをお勧めします。

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
&.is-success
background-color: #f8fff2
border: 1px solid var(--success)
color: var(--success-text)
&.is-primary
border: 1px solid var(--primary)
background-color: #f5f5ff
color: var(--primary-text)
&.is-warning
border: 1px solid var(--warning)
background-color: #fff9e7
color: var(--warning-text)
&.is-danger
border: 1px solid var(--danger)
background-color: var(--danger-tint)
color: var(--danger-text)
&.is-success
background-color: #f8fff2
border: 1px solid var(--success)
color: var(--success-text)
&::before
content: ""
margin-right: 0.5rem
&.is-primary
border: 1px solid var(--primary)
background-color: #f5f5ff
color: var(--primary-text)
&.is-warning
border: 1px solid var(--warning)
background-color: #fff9e7
color: var(--warning-text)
&.is-danger
border: 1px solid var(--danger)
background-color: var(--danger-tint)
color: var(--danger-text)
🤖 Prompt for AI Agents
In
app/javascript/stylesheets/application/blocks/cards/_card-body-main-actions.sass
lines 12 to 27, the current styling uses only color changes to indicate status,
which is not accessible for users with color vision deficiencies. To fix this,
add additional visual indicators such as icons or distinct border styles for
each status class (is-success, is-primary, is-warning, is-danger). Ensure these
indicators are clearly visible and consistent across all statuses to improve
accessibility.

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.

@hirokiej こちらの指摘に対応してください。(問題なければそのようにコメントして議論が決着するところまでやってください)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Copy Markdown
Contributor Author

@hirokiej hirokiej Jul 29, 2025

Choose a reason for hiding this comment

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

@komagata さん
承知しました!ありがとうございます🙇

@machida さん
こちらのcoderabbitaiの件ですが、提出物の確認部分でも日数だけでなく、色での判断もしています。
image
今回も件数を表示しているので修正は不要だと感じております。
デザインに関わる部分なので、町田さんの意見をいただけたら幸いです🙇

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.

@hirokiej 色での判断は不要ですー。理由は、提出物は期限があり、その期限にどれくらい迫っているかをすぐに確認できるように色が用意されているが、日報にはそれがないためです。

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.

@machida さん
ご返信ありがとうございます!
提出物のUIの意図も理解できました🙏
それでは、こちら問題なしということで対応いたします🙇

@coderabbitai
こちら、色での判断はしていないので問題ありません。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@hirokiej さん、ご説明ありがとうございます!

machidaさんからの説明もとても参考になりました。提出物と日報でのUI設計の意図の違いがよく理解できました。確かに、こちらの実装では件数が数値として明確に表示されており、色はあくまで視覚的な補助として機能しているため、アクセシビリティの問題はありませんね。

ご対応いただき、ありがとうございました!

(´・ω・`)


✏️ Learnings added
Learnt from: hirokiej
PR: fjordllc/bootcamp#8740
File: app/javascript/stylesheets/application/blocks/cards/_card-body-main-actions.sass:12-27
Timestamp: 2025-07-29T07:46:11.138Z
Learning: In this codebase, color coding serves different purposes for different features: submissions (提出物) use color indicators to show deadline urgency which is important for quick assessment, while daily reports (日報) don't require such urgency indicators. When implementing status indicators, the primary information should be conveyed through text/numbers rather than color alone for accessibility.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@hirokiej hirokiej force-pushed the feature/show-user-unchecked-report-count-only-mentor branch from b59205d to d8bd834 Compare June 29, 2025 02:15
@hirokiej hirokiej assigned su-su-su-su and unassigned machida and su-su-su-su Jun 29, 2025
@hirokiej hirokiej requested a review from su-su-su-su June 29, 2025 03:48
@hirokiej
Copy link
Copy Markdown
Contributor Author

hirokiej commented Jun 29, 2025

@su-su-su-su さん
お疲れ様です!レビュー依頼です!
こちらお願いしても良いでしょうか?🙇

@hirokiej hirokiej force-pushed the feature/show-user-unchecked-report-count-only-mentor branch from 5c1d939 to 199e349 Compare June 29, 2025 08:56
@su-su-su-su
Copy link
Copy Markdown
Contributor

su-su-su-su commented Jun 29, 2025

@hirokiej
お疲れ様です!

申し訳ございません。
他の方のレビューがまだできていないので他の方にお願いしていただければと思います🙇‍♂️
よろしくお願いいたします!

@hirokiej hirokiej requested review from kushimegu and removed request for su-su-su-su June 29, 2025 13:07
@hirokiej
Copy link
Copy Markdown
Contributor Author

@su-su-su-su さん
承知しました!ありがとうございます!

@kushimegu さん
お疲れ様です!レビュー依頼です!
こちらお願いしても良いでしょうか?🙇

hirokiej and others added 17 commits July 29, 2025 18:05
@hirokiej hirokiej force-pushed the feature/show-user-unchecked-report-count-only-mentor branch from ff0151c to 6f94e8b Compare July 29, 2025 09:05
@hirokiej
Copy link
Copy Markdown
Contributor Author

@komagata さん
ご確認ありがとうございます!
coderabbitaiの件、machidaさんに確認し解消しました🙇

修正も致しましたので、お手隙の際に再度ご確認よろしくお願いいたします🙇

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です〜🙆‍♂️

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.

5 participants