Merge pull request #6483 from HabitRPG/new-history-preening

fixes for new history preening, allow only 1 history entry per day in…
This commit is contained in:
Matteo Pagliazzi
2016-01-09 21:03:18 +01:00
2 changed files with 18 additions and 4 deletions

View File

@@ -50,8 +50,8 @@ export function preenHistory (history, isSubscribed, timezoneOffset) {
return date.isSame(monthsCutOff) || date.isAfter(monthsCutOff);
});
// Aggregate remaining entries by month and year
newHistory.unshift(..._aggregate(aggregateByMonth, 'YYYYMM'));
newHistory.unshift(..._aggregate(history, 'YYYY'));
if (history.length > 0) newHistory.unshift(..._aggregate(aggregateByMonth, 'YYYYMM'));
if (history.length > 0) newHistory.unshift(..._aggregate(history, 'YYYY'));
return newHistory;
}