Sort tab data by timestamp in descending order

This commit is contained in:
Rami Winestock
2023-12-19 17:14:59 +02:00
parent b22d683d4f
commit a49e2bcaad

View File

@@ -64,6 +64,19 @@ module.exports = Mn.View.extend({
const eventLevels = ["action item"];
const tab3Data = response.filter(item => eventLevels.includes(item.eventLevel.trim().toLowerCase()));
// Sort the data for each tab by timestamp in descending order.
tab1Data.sort((a, b) => {
return new Date(b.eventTime) - new Date(a.eventTime);
});
tab2Data.sort((a, b) => {
return new Date(b.eventTime) - new Date(a.eventTime);
});
tab3Data.sort((a, b) => {
return new Date(b.eventTime) - new Date(a.eventTime);
});
// Store the lengths of the original collections
this.tabCollectionLengths = {
tab1: response.length,