]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix grouped videos by date
authorChocobozzz <me@florianbigard.com>
Tue, 4 Jun 2019 08:15:18 +0000 (10:15 +0200)
committerChocobozzz <me@florianbigard.com>
Thu, 6 Jun 2019 09:43:00 +0000 (11:43 +0200)
client/src/app/shared/video/abstract-video-list.ts

index eba05c07d90278b3a32a18e1ed737fa18277376b..8cf21e9d452f3bb22dba7e763a837e2c95210080 100644 (file)
@@ -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
       }