-
Notifications
You must be signed in to change notification settings - Fork 75
Q&Aページの未解決タブおよびグローバルメニューに表示する未解決質問数の表示にキャッシュを使う #9221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
baa307a
チェック後の日報と提出物に確認ボタンが出てしまう不具合を修正
hirokiej 7fd807c
CorrectAnswerNotifierをnewspaperからActiveSupport::Notificationsへ移行
ryufuta ab4ac58
GraduationNotifierをnewspaperからActiveSupport::Notificationsへ移行
ryufuta e206393
ComebackNotifierをnewspaperからActiveSupport::Notificationsへ移行
ryufuta 40eaac4
Events.jsxを非React化した
sjabcdefin 6ae0bd2
Events.jsxの非React化に伴い不要となったファイルを削除
sjabcdefin 51fcc76
Events.jsxの非React化に伴いテストを修正
sjabcdefin edad3cf
CodeRabbitの指摘事項を修正
sjabcdefin d1aa1f2
修正箇所以外のCodeRabbitの指摘事項を修正
sjabcdefin ce41a59
カテゴリの位置を一番上に移動した
yokomaru d29aa3a
エラーの表示位置を他のページに合わせて移動した
yokomaru 5d20af4
Queryオブジェクトにリファクタリング
smallmonkeykey 94bd530
self_assigned_no_replied_product_idsをテストが通るように書き換え
smallmonkeykey 9dae3a8
テストで不要な箇所を削除とWIPを明示
smallmonkeykey 0c6cff0
published_atが同一のケースでも期待順になることを検証
smallmonkeykey 9221f70
ORDER BY部分を.reorder(nil)で明示的にクリアにする
smallmonkeykey d32587b
最後のコメントがチェック担当者本人でないテストケースを追加
smallmonkeykey 33ab4e1
本文を他のテストの内容と合わす
smallmonkeykey 2f4507d
テスト名を修正した
smallmonkeykey 4ef74fd
テスト名が日本語のため英語のテスト名に変更
karlley 9928b0b
初投稿のみというニュアンスのテスト名に変更
karlley 95f31c3
初日報というニュアンスをテスト名に追加
karlley c1c4f95
Merge pull request #9175 from fjordllc/chore/move-category-on-faq-page
komagata b1d5c93
お試し期間作成ボタンの位置を移動した
yokomaru ca87ad9
新規作成ページ上のお試し延長一覧ボタンに適用するCSSを変更した
yokomaru dee3984
Merge pull request #9109 from fjordllc/bug/check-button-disappear-aft…
komagata 1894d14
Refactor: Patterns::Queryに合わせたクエリ実装のリファクタリング
sharoa119 55a7555
GrassLearningTimeQueryで明示的なstart_date指定に対応
sharoa119 685001f
GrassLearningTimeQueryの年またぎ・月またぎ・velocity計算に関するテストを追加
sharoa119 8d66c89
Rubocopの指摘に従ってスタイル修正(ハッシュ記法、クオートなど)
sharoa119 0dd9261
学習時間集計SQLを最適化(期間フィルタ追加・暗黙キャスト解消・ORDER BY追加)
sharoa119 82d3bcd
GrassLearningTimeQuery の initialize を簡単にしてテストを整理
sharoa119 900813c
テスト名を修正: series が end_date.prev_year.sunday から始まることを明示
sharoa119 d4e30b9
reports(user_id, reported_on) にインデックスを追加
sharoa119 a570196
不要なインデックス idx_reports_user_date を削除
sharoa119 4dfd669
GrassLearningTimeQueryのvelocity計算で2h/4h/6hの境界値をテスト(タイポ修正含む)
sharoa119 49543e3
不要な reports インデックス関連マイグレーションを削除
sharoa119 ec8456d
お知らせにブックマーク機能を追加した
smallmonkeykey d29393c
fixtureに依存してたテストを、テスト内でデータを作成する形に変更した
smallmonkeykey 26e3c56
Bump rack from 2.2.17 to 2.2.18
dependabot[bot] 0359184
未確認の日報ページのURLを修正
komagata a069234
Merge pull request #9210 from fjordllc/bug/unchecked-reports
komagata 69f15f3
markdown-it-purifierを外した
komagata f60a1bf
uncheckedページのcontrollerを整理した
komagata 1478511
Merge pull request #9147 from fjordllc/chore/migrate-event-list-to-ra…
komagata 5e20ef6
Merge pull request #9150 from fjordllc/chore/refactor-product-self-as…
komagata 0d44aed
Merge pull request #9015 from fjordllc/chore/replace-newspaper-in-cor…
komagata 27b7a23
Merge pull request #9012 from fjordllc/chore/refactor-grass_times-method
komagata 2c7400d
Merge pull request #9207 from fjordllc/dependabot/bundler/rack-2.2.18
komagata 5f1522f
Merge pull request #8878 from fjordllc/chore/fix-japanese-test-title
komagata a969789
Merge pull request #9196 from fjordllc/feature/add-bookmark-to-announ…
komagata 5216319
Merge pull request #9179 from fjordllc/chore/move-campaign-create-button
komagata 3bcbeb1
Merge pull request #9213 from fjordllc/bug/html-in-quotes
komagata f21bb0b
不要なテストを削除
komagata 241422d
Merge pull request #9215 from fjordllc/chore/tidy-unchecked-controller
komagata cc1493c
textareaのsanitizeのテストをスキップした
komagata 0dd119a
Merge pull request #9227 from fjordllc/chore/skip-sanitize-test
komagata d9e852b
未チェックの日報を一括で開くボタンを復活させた
komagata 96f3cd0
新料金表示に変更
machida a0438e7
Merge pull request #9226 from fjordllc/changed-price
machida 2ee11c9
Merge pull request #9228 from fjordllc/bug/restore-open-all-reports-b…
komagata dcb4bf7
not_solved_question_countメソッドを修正
Miya096jp fb0e6a1
unsolved_badgeメソッドを修正
Miya096jp ff7f6b8
グローバルナビゲーションのQ&Aに表示する未解決質問数の参照先をCacheに置換
Miya096jp 2c6617f
デバッグ用にRails.loggerを追加
Miya096jp 528fcef
回答の作成・更新時の不要なキャッシュクリアを除去
Miya096jp a470dcb
キャッシュクリアのデバッグのため、Rails.loggerを追加
Miya096jp 2b8ccfa
削除する回答がベストアンサーの場合にのみキャッシュクリアを実行するように修正
Miya096jp c7420e4
回答削除のイベントリスナーにおいて、不要にcancelBestAnswerメソッドを呼び出していた部分を削除し、回答削除時に2重にキャッシ…
Miya096jp 14e1244
Rails.loggerにAnswerCacheControllerの呼び出し元情報を出力するように修正
Miya096jp 742f571
呼び出し情報をRails.loggerに渡すためのpayloadを追加
Miya096jp d388980
updateで定義されるローカル変数answerをNewspaperのpayloadに渡すように修正
Miya096jp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class Reports::UncheckedController < ApplicationController | ||
| PAGER_NUMBER = 25 | ||
| before_action :require_admin_or_mentor! | ||
|
|
||
| def index | ||
| @reports = Report.list.page(params[:page]).per(PAGER_NUMBER) | ||
| @reports = @reports.unchecked.not_wip | ||
| render 'reports/index' | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def require_admin_or_mentor! | ||
| redirect_to reports_path unless admin_or_mentor_login? | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,6 @@ | |
|
|
||
| .l-cards__item-inner | ||
| flex: 0 0 40rem | ||
| max-width: 100% | ||
| max-width: calc(100vw - 2rem) | ||
| .a-card | ||
| margin-inline: 0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,45 +1,7 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class Grass | ||
| # rubocop:disable Metrics/MethodLength | ||
| def self.times(user, end_date) | ||
| start_date = end_date.prev_year.sunday | ||
| sql = <<~SQL | ||
| WITH series AS ( | ||
| SELECT | ||
| date | ||
| FROM | ||
| generate_series(:start_date::DATE, :end_date, '1 day') AS series(date) | ||
| ), | ||
| summary AS ( | ||
| SELECT | ||
| reported_on AS date, | ||
| EXTRACT(epoch FROM SUM(finished_at - started_at)) / 60 / 60 AS total_hour | ||
| FROM | ||
| learning_times JOIN reports ON learning_times.report_id = reports.id | ||
| WHERE | ||
| reports.user_id = :user_id | ||
| GROUP BY | ||
| reported_on | ||
| ORDER BY | ||
| reported_on | ||
| ) | ||
| SELECT | ||
| series.date AS date, | ||
| CASE | ||
| WHEN summary.total_hour > 6 THEN 4 | ||
| WHEN 6 >= summary.total_hour AND summary.total_hour > 4 THEN 3 | ||
| WHEN 4 >= summary.total_hour AND summary.total_hour > 2 THEN 2 | ||
| WHEN 2 >= summary.total_hour AND summary.total_hour > 0 THEN 1 | ||
| ELSE 0 | ||
| END AS velocity | ||
| FROM | ||
| series | ||
| LEFT JOIN | ||
| summary ON series.date = summary.date | ||
| SQL | ||
|
|
||
| LearningTime.find_by_sql([sql, { start_date:, end_date:, user_id: user.id }]) | ||
| GrassLearningTimeQuery.call(user, end_date) | ||
| end | ||
| # rubocop:enable Metrics/MethodLength | ||
| end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
変数の不一致によるバグ
Line 22で
answerをローカル変数として定義していますが、Line 25のイベント発行では@answerを使用しています。updateアクションでは@answerが設定されていないため、nilがペイロードに含まれることになります。以下のdiffを適用して、正しい変数を使用するように修正してください:
def update answer = @question.answers.find(params[:answer_id]) answer.update!(type: '') Newspaper.publish(:answer_save, { - answer: @answer, + answer: answer, action: "#{self.class.name}##{action_name}" }) end📝 Committable suggestion
🤖 Prompt for AI Agents