From 14ceec18a646460b3bb70d3644ac92138dfd4877 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 25 Apr 2024 12:21:18 +0200 Subject: [PATCH] Watched state determined automatically --- .gitignore | 1 + api/progress.go | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index fd05ff7cf..a667c4814 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ bin .idea/**/usage.statistics.xml .idea/**/dictionaries .idea/**/shelf +.idea/copilot/ # Generated files .idea/**/contentModel.xml diff --git a/api/progress.go b/api/progress.go index 134881744..8ef03b554 100644 --- a/api/progress.go +++ b/api/progress.go @@ -114,11 +114,21 @@ func (r progressRoutes) saveProgress(c *gin.Context) { }) return } - progressBuff.add(model.StreamProgress{ - Progress: request.Progress, - StreamID: request.StreamID, - UserID: tumLiveContext.User.ID, - }) + if request.Progress > .9 { + progressBuff.add(model.StreamProgress{ + Progress: request.Progress, + StreamID: request.StreamID, + UserID: tumLiveContext.User.ID, + Watched: true, + }) + } else { + progressBuff.add(model.StreamProgress{ + Progress: request.Progress, + StreamID: request.StreamID, + UserID: tumLiveContext.User.ID, + }) + } + } // watchedRequest corresponds the request that is sent when a user marked the video as watched on the watch page.