Skip to content
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

[Q&A]質問の本公開時にメンター側のWatchを自動的にonにするように修正 #4530

Merged

Conversation

Paru871
Copy link
Contributor

@Paru871 Paru871 commented Mar 30, 2022

Issue

概要

Q&AのWIP機能の付加(#4157)により、質問が作成された際に自動的にメンターさんのみ「Watch中」になるタイミングがWIP保存時にも働いてしまうため、タイミングを「本公開時」にWatch中になるよう修正しました。

参考PR

Refs: #3120

修正の内容

  • 質問作成後にメンター側へ自動的にWatchをonにしていた処理はWIP導入以前はapp/controllers/questions_controller.rbにて実装していましたが、app/models/question_callbacks.rbafter_save内へ移動させ、質問の初回の本公開時に行うように変更しました。
  • N+1への対策としてinsert_allを使うことと、ここにrubocopの指摘が入るのを無効化することは、以前の実装時の受講生とアドバイザーさん、駒形さんとのやり取り・指示をそのまま受け継ぎました。
    詳細は下記のコメントをご覧ください。
    https://github.com/fjordllc/bootcamp/pull/3120/files#r700293736

修正前

  • WIPで保存時にすでに「Watch中」ボタンがonになってしまっている
    スクリーンショット 2022-03-24 8 55 41

修正後

  • WIPで保存時には「Watch中」ボタンがonにならない
    image

  • 質問の本公開時には「Watch中」ボタンがonになる
    image

動作確認手順

  1. 手元に本ブランチを取り込む。
  2. bin/setup rails db:resetを行い初期化した後、rails sにて開発環境を立ち上げる
  3. 下記の手順で動作確認を行う。
    1. 受講生ユーザーでログインして質問を新規作成し、「登録する」で本公開する。
    2. メンターでログインして該当の本公開済みの質問が「Watch中」になっているのを確認する。
    3. 受講生ユーザーでログインして質問を新規作成し、「WIP」をクリックしてwip保存する。
    4. メンターでログインして該当のwIP中の質問が「Watch中」ではないのを確認する。
    5. 上で質問を作成した受講生ユーザーでログインしてwip保存した質問を「内容修正」から「質問を公開」をクリックして本公開する。
    6. メンターでログインして該当の本公開済みの質問が「Watch中」になっているのを確認する。

@Paru871 Paru871 self-assigned this Mar 30, 2022
@Paru871 Paru871 requested a review from taka110-IT March 30, 2022 07:52
@Paru871
Copy link
Contributor Author

Paru871 commented Mar 30, 2022

@taka110-IT
お疲れさまです。
昨晩、#4526 のプルリクにてレビューのお願いをいたしました。
その後ブランチ名の変更作業を行なったところ、プルリクの作り直しとなってしまいました。大変失礼いたしました🙇🏻‍♀️
こちらの新しい方で改めてレビューのお願いをさせていただきます。お手すきの際によろしくお願いいたします🙏

@taka110-IT
Copy link
Contributor

@Paru871 さん
承知しました。順次拝見しますので少々お時間をいただきます。

@Paru871 Paru871 requested review from aim2bpg and removed request for taka110-IT April 7, 2022 13:18
@Paru871
Copy link
Contributor Author

Paru871 commented Apr 7, 2022

@taka110-IT
お疲れさまです。お忙しそうなのといろいろご負担がかかっていらっしゃるとお見受けしましたので、レビューの依頼はキャンセルとさせていただきますー🙇🏻‍♀️
また機会がありましたらよろしくお願いいたします🙏

@Paru871
Copy link
Contributor Author

Paru871 commented Apr 7, 2022

@aim2bpg
お疲れさまです。お忙しいなかお手数をおかけしてしまい申し訳ありませんが、
お手すきの際にレビューをいただきたく、何とぞよろしくお願いいたします🙇🏻‍♀️

@taka110-IT
Copy link
Contributor

@Paru871
時間だけ無駄に経過してしまい大変申し訳ありませんでした。

Comment on lines 233 to 237
within 'form[name=question]' do
fill_in 'question[title]', with: 'メンターのみ投稿された質問が"Watch中"になるテスト'
fill_in 'question[description]', with: 'メンターのみ投稿された質問が"Watch中"になるテスト'
click_button '登録する'
end
Copy link
Contributor

Choose a reason for hiding this comment

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

click_buttonがブロック内外にありますので統一した方が良いかと思いました。
本ファイルを上から見ていくと、ブロック内で統一された方がよさそうです。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ありがとうございます!
今回作成したテスト3つについて、ブロック内にclick_buttonを書くように統一いたしました。

within 'form[name=question]' do
fill_in 'question[title]', with: 'メンターのみ投稿された質問が"Watch中"になるテスト'
fill_in 'question[description]', with: 'メンターのみ投稿された質問が"Watch中"になるテスト'
click_button '登録する'
end
visit_with_auth questions_path, 'komagata'
Copy link
Contributor

@aim2bpg aim2bpg Apr 8, 2022

Choose a reason for hiding this comment

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

visit_with_authの前に空行があると見やすくなるのではと思いました。
そういえば、この前には「質問を作成しました。」はチェックされないのですね。
以降では、メッセージをチェックしているのでここも統一感を持たせた方が良いかと思いました。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

「質問を作成しました。」のチェックが抜けていましたので追加しました。
見つけてくださってありがとうございます!助かりましたー🙏
統一感が大事、しっかり覚えたいと思います。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

visit_with_authの前に空行を作るのも、今回作成した3つのテストについて統一して修正しました。
ありがとうございます!

within 'form[name=question]' do
fill_in 'question[title]', with: 'メンターのみ投稿された質問が"Watch中"になるテスト'
fill_in 'question[description]', with: 'メンターのみ投稿された質問が"Watch中"になるテスト'
click_button '登録する'
end
visit_with_auth questions_path, 'komagata'
click_link 'メンターのみ投稿された質問が"Watch中"になるテスト'
assert_text 'kimura (Kimura Tadasi)'
Copy link
Contributor

Choose a reason for hiding this comment

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

一覧ページではなく、詳細ページであることの確認意図でユーザー名をチェックされているのかと思いました。だとすると、一覧ページにも出現しますので、違う目印が良いかもです。例えば「削除する」など。。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

確かに書いてくださったとおりだと思いました!ありがとうございました。
ご提案いただいた「削除する」が良いと思いましたので採用させていただき、今回作成した3つのテストについて詳細ページであることを確認する項目として修正を行いました。

Copy link
Contributor

@aim2bpg aim2bpg left a comment

Choose a reason for hiding this comment

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

動作確認で問題ないことを確認しました。手順がわかりやすくて助かりました。
テストの書き方でいくつかコメントさせていただきました。
ご確認をお願いいたします〜🙏

@aim2bpg
Copy link
Contributor

aim2bpg commented Apr 8, 2022

@Paru871 さん、久しぶりでメンション忘れてましたので、本コメントでメンション飛ばさせていただきます🙏

@Paru871 Paru871 force-pushed the feature/mentors-will-be-on-watch-when-question-is-published branch from 9ca3b0d to b336f1b Compare April 8, 2022 06:13
@Paru871
Copy link
Contributor Author

Paru871 commented Apr 8, 2022

@aim2bpg
このたびはお忙しいなか、早速にチェックしてくださりありがとうございました。
書いてくださったことはどれもそのとおりだと思いましたので、今回作成したテスト3つについて修正を行いました。
お手数をおかけしますがお手すきの際に再度チェックいただきたく、よろしくお願いいたします🙏

@Paru871 Paru871 requested a review from aim2bpg April 8, 2022 06:39
Copy link
Contributor

@aim2bpg aim2bpg left a comment

Choose a reason for hiding this comment

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

@Paru871 さん、修正ありがとうございます。
私はOKです🙆‍♀️

@Paru871
Copy link
Contributor Author

Paru871 commented Apr 8, 2022

@aim2bpg
このたびはお忙しいなか、あたたかくご対応&的確なチェックをしてくださり本当にありがとうございました。
大変助かりました🙇🏻‍♀️

@Paru871
Copy link
Contributor Author

Paru871 commented Apr 8, 2022

@komagata
チームメンバーさんのレビューと修正が終わりましたので、
お手すきの際にご確認をよろしくお願いいたします。

@Paru871 Paru871 requested a review from komagata April 8, 2022 10:27
Copy link
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 f13d5f0 into main Apr 13, 2022
@komagata komagata deleted the feature/mentors-will-be-on-watch-when-question-is-published branch April 13, 2022 11:57
@github-actions github-actions bot mentioned this pull request Apr 13, 2022
13 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