Skip to content

Commit

Permalink
Watched state determined automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
SebiWrn committed Apr 25, 2024
1 parent 759d9de commit 14ceec1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ bin
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
.idea/copilot/

# Generated files
.idea/**/contentModel.xml
Expand Down
20 changes: 15 additions & 5 deletions api/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}

Check failure on line 131 in api/progress.go

View workflow job for this annotation

GitHub Actions / lint (./...)

File is not `gofumpt`-ed (gofumpt)

Check failure on line 131 in api/progress.go

View workflow job for this annotation

GitHub Actions / lint (./worker)

File is not `gofumpt`-ed (gofumpt)

Check failure on line 131 in api/progress.go

View workflow job for this annotation

GitHub Actions / lint (./worker/edge)

File is not `gofumpt`-ed (gofumpt)
}

// watchedRequest corresponds the request that is sent when a user marked the video as watched on the watch page.
Expand Down

0 comments on commit 14ceec1

Please sign in to comment.