-
Notifications
You must be signed in to change notification settings - Fork 3
通信が1時間なかったらonlineから外すようにした #107
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
base: development
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## development #107 +/- ##
===============================================
+ Coverage 97.59% 97.63% +0.03%
===============================================
Files 33 33
Lines 415 422 +7
===============================================
+ Hits 405 412 +7
Misses 10 10
Continue to review full report at Codecov.
|
708f5a6
to
2641f75
Compare
app/models/user_room_log.rb
Outdated
@@ -7,7 +7,7 @@ class UserRoomLog < ApplicationRecord | |||
after_create :send_enter_message | |||
after_update :send_exit_message, if: proc { |log| log.exit_at_before_last_save.blank? && log.exit_at.present? } | |||
|
|||
scope :online, -> { where exit_at: nil } | |||
scope :online, -> { where(exit_at: nil).where("updated_at > ?", Time.now.utc - 60 * 60) } |
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.
scope :online, -> { where(exit_at: nil).where("updated_at > ?", Time.now.utc - 60 * 60) } | |
scope :online, -> { where(exit_at: nil).where(updated_at: 1.hour.ago..Time.current) } |
spec/models/user_room_log_spec.rb
Outdated
end | ||
end | ||
|
||
context "when exit_at exsit" 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.
context "when exit_at exsit" do | |
context "when exit_at exist" 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.
みました
action cableでunsubscribeが呼ばれない場合がある
通信時にroom_user_logのupdated_atを更新し、それによってonlnieに表示するかしないか切り替えるようにした
懸念点