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

提出物を更新した時の通知の文面を変更した #6772

Merged

Conversation

Kassy0220
Copy link
Contributor

@Kassy0220 Kassy0220 commented Jul 30, 2023

Issue

概要

以下の2つの通知に関して、提出物が更新された場合に飛ぶ通知の文面が〇〇さんが「×××」の提出物を提出しました。となっていたのを、〇〇さんの提出物が更新されましたとなるよう変更しました。

  • 提出物が作成or更新された際に、そのプラクティスをwatchしているメンターに飛ぶ通知
  • 企業の研修生が提出物を作成or更新した際に、同じ企業に属しているアドバイザーに飛ぶ通知

変更確認方法

最初に、次の下準備をお願いします。

  1. feature/change-notification-message-when-product-is-updatedをローカルに取り込む
  2. foreman start -f Procfile.devでサーバを起動
  3. komagataでログイン
  4. プラクティス一覧ページを開き、「Terminalの基礎を覚える」プラクティスを選択。
_development__Railsプログラマーコース___FBC
  1. プラクティスをWatchする。
_development__Terminalの基礎を覚える___FBC

提出物を提出し、更新した場合

  1. kensyuでログイン
  2. 「Terminalの基礎を覚える」プラクティスの提出物を提出する
  3. senpaiでログインし、kensyuさんが「Terminalの基礎を覚える」の提出物を提出しましたという通知が来ていることを確認する
  4. komagataでログインし、kensyuさんが「Terminalの基礎を覚える」の提出物を提出しましたという通知が来ていることを確認する
  5. kensyuでログインし、2で提出した提出物を再提出する
  6. senpaiでログインし、kensyuさんの提出物が更新されましたという通知が来ていることを確認する
  7. komagataでログインし、kensyuさんの提出物が更新されましたという通知が来ていることを確認する

7まで確認が終わったら、次の確認に備えて2で作成した提出物を削除します。

最初に提出物をWIPで保存し、提出した場合

  1. kensyuでログイン
  2. 「Terminalの基礎を覚える」プラクティスの提出物を、WIPで保存する
  3. 2で保存した提出物を、提出する
  4. senpaiでログインし、kensyuさんが「Terminalの基礎を覚える」の提出物を提出しましたという通知が来ていることを確認する
  5. komagataでログインし、kensyuさんが「Terminalの基礎を覚える」の提出物を提出しましたという通知が来ていることを確認する

5まで確認が終わったら、次の確認に備えて2で保存した提出物を削除します。

提出物を提出し、WIPで保存し、更新した場合

  1. kensyuでログイン
  2. 「Terminalの基礎を覚える」プラクティスの提出物を提出する
  3. senpaiでログインし、kensyuさんが「Terminalの基礎を覚える」の提出物を提出しましたという通知が来ていることを確認する
  4. komagataでログインし、kensyuさんが「Terminalの基礎を覚える」の提出物を提出しましたという通知が来ていることを確認する
  5. kensyuでログインし、2で提出した提出物を、WIPで保存する。
  6. 5で保存した提出物を、提出する。
  7. senpaiでログインし、kensyuさんの提出物が更新されましたという通知が来ていることを確認する
  8. komagataでログインし、kensyuさんの提出物が更新されましたという通知が来ていることを確認する

Screenshot

変更前

  • プラクティスをWatchしているメンターに飛ぶ通知
_development__ダッシュボード___FBC
  • 同じ企業に所属しているアドバイザーに飛ぶ通知
_development__ダッシュボード___FBC

変更後

  • プラクティスをWatchしているメンターに飛ぶ通知
_development__ダッシュボード___FBC
  • 同じ企業に所属しているアドバイザーに飛ぶ通知
_development__ダッシュボード___FBC

@Kassy0220 Kassy0220 self-assigned this Jul 31, 2023
@Kassy0220
Copy link
Contributor Author

@rira100000000

お疲れ様です🍵
こちらのPRのレビューをお願いしたいのですが、よろしいでしょうか?

急ぎではありませんので、よろしくお願いいたします🙏

@Kassy0220 Kassy0220 marked this pull request as ready for review July 31, 2023 02:29
@rira100000000
Copy link
Contributor

@Kassy0220
レビュー依頼ありがとうございます!承知しました!
1週間以内にはできるかと思いますので、お待ちください🙏

@Kassy0220 Kassy0220 force-pushed the feature/change-notification-message-when-product-is-updated branch 4 times, most recently from 7ddc292 to 9d3dbc7 Compare August 4, 2023 22:22
Copy link
Contributor

@rira100000000 rira100000000 left a comment

Choose a reason for hiding this comment

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

遅くなってしまいすいませんでした!
1点だけコメントさせていただきました。

細かいことなんですが、PRのタイトルが「提出物を更新した時の…」の方が適当かと思いました。
よろしくお願いします🙏

@@ -24,8 +24,9 @@ def notify_advisers(product)
end

def send_notification(product:, receivers:)
notification = product.updated_after_submission? ? :product_update : :submitted
Copy link
Contributor

Choose a reason for hiding this comment

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

こことproduct_notifier_for_practice_watcher.rbに追加されてる同処理はあえて重複させているのでしょうか?
例えばproduct.rbにnotification_typeみたいなメソッドを作ってそこで判断させれば、notifyの()内で直接呼び出せ、DRYにできる気がしました。
あえて重複させている理由があれば教えてください~🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

この箇所は重複させている意味はなく、私の見落としになります💦
通知のタイプを判断するメソッドを追加しました。

  def notification_type
    updated_after_submission? ? :product_update : :submitted
  end

notification_typeで通知の種類を提供することで、通知を送る側(product_notifier_for_practice_watcher.rbなど)はそれを利用すれば良く、役割が分かりやすくなりました。
テストコードも何をテストしているのか分かりやすくなったので、コードがよりよくなったと思います🙌

@Kassy0220 Kassy0220 changed the title 提出を更新した時の通知の文面を変更した 提出物を更新した時の通知の文面を変更した Aug 5, 2023
@Kassy0220
Copy link
Contributor Author

@rira100000000
レビューありがとうございます!

ご指摘の箇所(PRのタイトルとコードの重複)を修正しましたので、ご確認をよろしくお願いいたします🙏

Copy link
Contributor

@rira100000000 rira100000000 left a comment

Choose a reason for hiding this comment

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

修正ありがとうございます!
テストもわかりやすくなっていい感じですね!
approveとさせていただきます~。

@Kassy0220
Copy link
Contributor Author

@rira100000000
レビューありがとうございました!とても参考になりました🙌

@komagata
チームメンバーのレビューが通ったため、レビューをお願いいたします🙇🏻

@Kassy0220 Kassy0220 requested a review from komagata August 6, 2023 07:28
@Kassy0220 Kassy0220 force-pushed the feature/change-notification-message-when-product-is-updated branch 2 times, most recently from a777540 to 58f405b Compare August 11, 2023 22:01
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.

テストが落ちているようです。

テストが成功してからのレビュー依頼をお願いします。

@Kassy0220 Kassy0220 force-pushed the feature/change-notification-message-when-product-is-updated branch from 58f405b to 0f99e33 Compare August 16, 2023 09:32
@Kassy0220
Copy link
Contributor Author

@komagata
こちらテストが通りましたので、ご確認をよろしくお願いいたします🙏

@Kassy0220 Kassy0220 force-pushed the feature/change-notification-message-when-product-is-updated branch from 0f99e33 to ffba731 Compare August 18, 2023 09:46
@@ -196,4 +196,14 @@ def delete_last_commented_at
def delete_commented_at
update_commented_at(comments.last)
end

def notification_type
Copy link
Member

Choose a reason for hiding this comment

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

👍

@@ -159,4 +159,35 @@ class ProductTest < ActiveSupport::TestCase
product_id_list = Product.self_assigned_no_replied_products(mentor.id).pluck(:id)
assert_not_includes product_id_list, no_replied_wip_product.id
end

test '#notification_type return :product_update when product is updated after submission' do
Copy link
Member

Choose a reason for hiding this comment

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

モデルのテストなので下記のように単純にメソッドに対応したテストで良いかもです。

test '#notification_type' do
  # ...
end

test '#updated_after_submission?' do
  # ...
end

(すでにある既存のテストもその方が望ましいですがレビューで漏れていたようです。そのうち直したい…)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

次のコミットでテスト名を修正し、2つに分けていた#notification_typeのテストを一つにまとめました。
101a5aa

また、次のコミットで#updated_after_submission?のテストを追加しました。
1ea6a37

既存のテスト名が好ましくない箇所を修正するIssueも作成しました。
Productモデルのテスト名を修正したい · Issue #6835 · fjordllc/bootcamp

修正もできるだけ早く行いますので、よろしくお願いします🙏

@Kassy0220 Kassy0220 force-pushed the feature/change-notification-message-when-product-is-updated branch from ffba731 to 5001ab6 Compare August 23, 2023 09:00
@Kassy0220 Kassy0220 force-pushed the feature/change-notification-message-when-product-is-updated branch from 35ebdd6 to 1ea6a37 Compare August 27, 2023 22:58
@Kassy0220
Copy link
Contributor Author

@komagata
ご指摘の箇所の修正を行い、漏れていたテストを追加しましたので、ご確認をよろしくお願いいたします🙏

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 03fb229 into main Aug 29, 2023
3 checks passed
@komagata komagata deleted the feature/change-notification-message-when-product-is-updated branch August 29, 2023 15:29
@github-actions github-actions bot mentioned this pull request Aug 29, 2023
4 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.

None yet

3 participants