Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watched state determined automatically #1350

Merged
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
1 change: 0 additions & 1 deletion api/info-pages.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func (r infoPageRoutes) updateText(c *gin.Context) {
RawContent: reqBody.RawContent,
Type: reqBody.Type,
})

if err != nil {
_ = c.Error(tools.RequestError{
Status: http.StatusInternalServerError,
Expand Down
19 changes: 14 additions & 5 deletions api/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,20 @@ 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,
})
}
SebiWrn marked this conversation as resolved.
Show resolved Hide resolved
}

// watchedRequest corresponds the request that is sent when a user marked the video as watched on the watch page.
Expand Down
1 change: 1 addition & 0 deletions tools/realtime/connector/melody.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package connector

import (
"net/http"

"github.com/TUM-Dev/gocast/tools/realtime"
"github.com/gabstv/melody"
)
Expand Down
Loading