mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-28 01:36:33 +08:00
Update method last_sync_timestamp from Last to First user
This commit is contained in:
parent
2364c2653f
commit
62bc0520e9
2 changed files with 4 additions and 3 deletions
|
@ -51,6 +51,6 @@ class SystemNotification < ApplicationRecord
|
|||
SystemNotification
|
||||
.order(last_time_changed_at: :desc)
|
||||
.first&.last_time_changed_at&.to_i ||
|
||||
User.order(created_at: :desc).first&.created_at&.to_i
|
||||
User.order(created_at: :asc).first&.created_at&.to_i
|
||||
end
|
||||
end
|
||||
|
|
|
@ -56,11 +56,12 @@ describe SystemNotification do
|
|||
end
|
||||
|
||||
context 'when there is no system notifications in db' do
|
||||
it 'returns last user created_at' do
|
||||
it 'returns first users created_at' do
|
||||
create :user
|
||||
create :user, created_at: Time.now + 5.seconds
|
||||
|
||||
expect(described_class.last_sync_timestamp)
|
||||
.to be == User.last.created_at.to_i
|
||||
.to be == User.first.created_at.to_i
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue