From 4e0c179365461e9f1f04339b3d5b32d538fea0c4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 4 Jun 2019 10:15:18 +0200 Subject: Fix grouped videos by date --- client/src/app/shared/video/abstract-video-list.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'client') diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts index eba05c07d..8cf21e9d4 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/video/abstract-video-list.ts @@ -167,31 +167,41 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor for (const video of this.videos) { const publishedDate = video.publishedAt - if (currentGroupedDate < GroupDate.TODAY && isToday(publishedDate)) { + if (currentGroupedDate <= GroupDate.TODAY && isToday(publishedDate)) { + if (currentGroupedDate === GroupDate.TODAY) continue + currentGroupedDate = GroupDate.TODAY this.groupedDates[ video.id ] = currentGroupedDate continue } - if (currentGroupedDate < GroupDate.YESTERDAY && isYesterday(publishedDate)) { + if (currentGroupedDate <= GroupDate.YESTERDAY && isYesterday(publishedDate)) { + if (currentGroupedDate === GroupDate.YESTERDAY) continue + currentGroupedDate = GroupDate.YESTERDAY this.groupedDates[ video.id ] = currentGroupedDate continue } - if (currentGroupedDate < GroupDate.THIS_WEEK && isThisWeek(publishedDate)) { + if (currentGroupedDate <= GroupDate.THIS_WEEK && isThisWeek(publishedDate)) { + if (currentGroupedDate === GroupDate.THIS_WEEK) continue + currentGroupedDate = GroupDate.THIS_WEEK this.groupedDates[ video.id ] = currentGroupedDate continue } - if (currentGroupedDate < GroupDate.THIS_MONTH && isThisMonth(publishedDate)) { + if (currentGroupedDate <= GroupDate.THIS_MONTH && isThisMonth(publishedDate)) { + if (currentGroupedDate === GroupDate.THIS_MONTH) continue + currentGroupedDate = GroupDate.THIS_MONTH this.groupedDates[ video.id ] = currentGroupedDate continue } - if (currentGroupedDate < GroupDate.OLDER) { + if (currentGroupedDate <= GroupDate.OLDER) { + if (currentGroupedDate === GroupDate.OLDER) continue + currentGroupedDate = GroupDate.OLDER this.groupedDates[ video.id ] = currentGroupedDate } -- cgit v1.2.3