-
Notifications
You must be signed in to change notification settings - Fork 72
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
「近日開催のイベント」で、当日の開催時間を過ぎたイベントは非表示にする #8280
base: main
Are you sure you want to change the base?
「近日開催のイベント」で、当日の開催時間を過ぎたイベントは非表示にする #8280
Conversation
dd91341
to
47c792a
Compare
47c792a
to
ed505b9
Compare
@Judeeeee |
@sugiwe |
@Judeeeee |
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.
@sugiwe
お疲れ様ですー!
ブラウザ上での動作確認は問題ありませんでした🙆
気になった箇所にコメントをしたので、ご確認くださいー🙏
@@ -135,4 +135,20 @@ class EventTest < ActiveSupport::TestCase | |||
assert 994_018_171, ids | |||
assert 205_042_674, ids | |||
end | |||
|
|||
test 'Events in progress today should be displayed' do |
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.
modelテストなので、メソッドのみをテストした方がよさそうです🙆
test '.scheduled_on_without_ended' do
# テストを記述する
end
のような形になりそうですかね👀
Events in progress today should be displayed
Events that have already ended today should not be displayed
は、システムテストで確認した方がまとまりがよいかと思います〜
システムテストが非常に重いため増やしたくない意図からmodelテストに書かれたかもしれないのですが、他のテストもメソッドをテストする書き方をしているので整合性の面でもシステムテストで書いた方が良い気がします🧐(折角fixtureでイベントも作成しているので)
また、実際にシステムテストを書く際の補足ですが、私が過去にこのように指摘されたことがあるので、「表示されるorされない」のどちらかを確認するテストだけで十分だと思います👌
@@ -154,4 +154,20 @@ class RegularEventTest < ActiveSupport::TestCase | |||
assert_equal 157, participated_regular_events.count | |||
end | |||
end | |||
|
|||
test 'Regular event in progress today should be displayed' do |
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.
ここのモデルテストもevent_testのコメントと同様です🙆
@@ -44,6 +44,8 @@ class Event < ApplicationRecord | |||
scope :wip, -> { where(wip: true) } | |||
scope :related_to, ->(user) { user.job_seeker ? all : where.not(job_hunting: true) } | |||
scope :scheduled_on, ->(date) { where(start_at: date.midnight...(date + 1.day).midnight) } | |||
scope :not_ended, -> { where('end_at > ?', Time.current) } | |||
scope :scheduled_on_without_ended, ->(date) { scheduled_on(date).not_ended } |
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.
レビューのために質問させてください🙏
scheduled_on_without_ended
をEvent
クラスとRegularEvent
クラスの両方で定義している意図って何でしょうか?👀
それぞれのイベント(特別イベント・定期イベント)の違いで混乱しており、補足があればご教示いただけると幸いです🙇
Issue
概要
変更確認方法
feature/do-not-display-finished-events-in-upcoming-events-group
git fetch origin pull/8280/head:feature/do-not-display-finished-events-in-upcoming-events-group
git switch feature/do-not-display-finished-events-in-upcoming-events-group
rails c
で rails console を立ち上げるforeman start -f Procfile.dev
でローカルサーバーを立ち上げる※どちらのイベントも、
end_at: Time.current + 5.minute
により5分後に終了する状態となっております。もしご確認ステップの3〜5の間で5分以上経ってしまった場合は初めからイベントが表示されていない状態になりますので、お手数ですが改めてイベントを作成してください(end_at: Time.current + 10.minute
にするなど終了時刻を調整することで時間に余裕を持たせることができます)Screenshot
変更前
※各スクリーンショットで、画面右上に表示されている時間についても併せてご覧ください
イベント作成直後(イベント終了前)
イベント作成から5分以上経過後(イベント終了後)
変更後
イベント作成直後(イベント終了前)
イベント作成から5分以上経過後(イベント終了後)
参考までに、イベント一覧画面の方では勿論イベントの情報は確認できます