From 2edc89fc0704dc9b2b1ea376dbfc9805f8fa3d7a Mon Sep 17 00:00:00 2001 From: root Date: Thu, 9 Dec 2021 18:24:36 +0530 Subject: [PATCH] Filtering by unwatched videos --- src/components/VideoItem.vue | 8 ++------ src/routes/WatchHistory.vue | 28 +++++++++++++++++++++------- src/routes/WatchVideo.vue | 2 +- src/store/watched-videos-db.js | 15 +++++++++++---- 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/src/components/VideoItem.vue b/src/components/VideoItem.vue index 06e77f4..31c45dd 100644 --- a/src/components/VideoItem.vue +++ b/src/components/VideoItem.vue @@ -49,15 +49,11 @@ export default { }, methods: { - calcProgress (prog, dur) { - return Math.min((prog / dur) * 100, 100) - }, - async findIfVideoWatched () { // if it has source progress, it's already seen if (this.srcProgress) { this.alreadyWatched = true - this.progress = this.calcProgress(this.srcProgress, this.video.duration) + this.progress = this.srcProgress return } @@ -72,7 +68,7 @@ export default { const lastVideo = await findLastWatch(videoId) if (lastVideo != null) { this.alreadyWatched = true - this.progress = lastVideo.progress != null ? this.calcProgress(lastVideo.progress, lastVideo.video.duration) : 100 + this.progress = lastVideo.progressPcnt } else { this.alreadyWatched = false } diff --git a/src/routes/WatchHistory.vue b/src/routes/WatchHistory.vue index 46dad97..7186a1e 100644 --- a/src/routes/WatchHistory.vue +++ b/src/routes/WatchHistory.vue @@ -1,14 +1,17 @@