Fix grouped videos by date

pull/1913/head
Chocobozzz 2019-06-04 10:15:18 +02:00
parent 838f4a7983
commit 4e0c179365
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 15 additions and 5 deletions

View File

@ -167,31 +167,41 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
for (const video of this.videos) { for (const video of this.videos) {
const publishedDate = video.publishedAt const publishedDate = video.publishedAt
if (currentGroupedDate < GroupDate.TODAY && isToday(publishedDate)) { if (currentGroupedDate <= GroupDate.TODAY && isToday(publishedDate)) {
if (currentGroupedDate === GroupDate.TODAY) continue
currentGroupedDate = GroupDate.TODAY currentGroupedDate = GroupDate.TODAY
this.groupedDates[ video.id ] = currentGroupedDate this.groupedDates[ video.id ] = currentGroupedDate
continue continue
} }
if (currentGroupedDate < GroupDate.YESTERDAY && isYesterday(publishedDate)) { if (currentGroupedDate <= GroupDate.YESTERDAY && isYesterday(publishedDate)) {
if (currentGroupedDate === GroupDate.YESTERDAY) continue
currentGroupedDate = GroupDate.YESTERDAY currentGroupedDate = GroupDate.YESTERDAY
this.groupedDates[ video.id ] = currentGroupedDate this.groupedDates[ video.id ] = currentGroupedDate
continue 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 currentGroupedDate = GroupDate.THIS_WEEK
this.groupedDates[ video.id ] = currentGroupedDate this.groupedDates[ video.id ] = currentGroupedDate
continue 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 currentGroupedDate = GroupDate.THIS_MONTH
this.groupedDates[ video.id ] = currentGroupedDate this.groupedDates[ video.id ] = currentGroupedDate
continue continue
} }
if (currentGroupedDate < GroupDate.OLDER) { if (currentGroupedDate <= GroupDate.OLDER) {
if (currentGroupedDate === GroupDate.OLDER) continue
currentGroupedDate = GroupDate.OLDER currentGroupedDate = GroupDate.OLDER
this.groupedDates[ video.id ] = currentGroupedDate this.groupedDates[ video.id ] = currentGroupedDate
} }