Merge pull request #5309 from aignatov-bio/ai-sci-8325-fix-date-sorting-in-notifications

Fix date sorting in notifications [SCI-8325]
This commit is contained in:
aignatov-bio 2023-04-17 11:23:37 +02:00 committed by GitHub
commit 18590b502d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View file

@ -65,6 +65,7 @@ class UserNotificationsController < ApplicationController
title: notification.title,
message: notification.message,
created_at: I18n.l(notification.created_at, format: :full),
today: notification.created_at.today?,
checked: notification.checked
}
end

View file

@ -75,12 +75,10 @@ export default {
this.loadNotifications();
},
todayNotifications() {
let startOfDay = (new Date()).setUTCHours(0, 0, 0, 0);
return this.notifications.filter(n => moment(n.created_at) >= startOfDay);
return this.notifications.filter(n => n.today);
},
olderNotifications() {
let startOfDay = (new Date()).setUTCHours(0, 0, 0, 0);
return this.notifications.filter(n => moment(n.created_at) < startOfDay);
return this.notifications.filter(n => !n.today);
}
},
methods: {