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

1365 daten zum live view count #1366

Merged
merged 14 commits into from
Sep 11, 2024
Prev Previous commit
Next Next commit
Fixed golangci-lint
  • Loading branch information
SebiWrn committed Aug 9, 2024
commit b225b9f9771af0cd43145d5b40a3e6ade800a794
2 changes: 1 addition & 1 deletion dao/statistics.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (d statisticsDao) GetLectureStats(courseID uint, streamID uint) ([]Stat, er
JOIN streams s ON s.id = stats.stream_id
WHERE s.course_id = ? AND s.id = ? AND stats.live = 1
ORDER BY x;`, courseID, streamID).Scan(&res).Error
//err := DB.Raw(`SELECT TIMESTAMPDIFF(MINUTE, s.start, stats.time) AS x, stats.viewers AS y
// err := DB.Raw(`SELECT TIMESTAMPDIFF(MINUTE, s.start, stats.time) AS x, stats.viewers AS y
// FROM stats
// JOIN streams s ON s.id = stats.stream_id
// WHERE s.course_id = ? AND stats.live = 1
Expand Down
2 changes: 0 additions & 2 deletions web/admin.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
"github.com/getsentry/sentry-go"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
"net/http"
"regexp"
)

// AdminPage serves all administration pages. todo: refactor into multiple methods
Expand All @@ -21,12 +19,12 @@
foundContext, exists := c.Get("TUMLiveContext")
if !exists {
sentry.CaptureException(errors.New("context should exist but doesn't"))
c.AbortWithStatus(http.StatusInternalServerError)

Check failure on line 22 in web/admin.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: http

Check failure on line 22 in web/admin.go

View workflow job for this annotation

GitHub Actions / lint (./...)

undefined: http
return
}
tumLiveContext := foundContext.(tools.TUMLiveContext)
if tumLiveContext.User == nil {
c.Redirect(http.StatusFound, "/login")

Check failure on line 27 in web/admin.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: http

Check failure on line 27 in web/admin.go

View workflow job for this annotation

GitHub Actions / lint (./...)

undefined: http
return
}
var users []model.User
Expand Down Expand Up @@ -84,7 +82,7 @@
tokens, err = r.TokenDao.GetAllTokens()
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
logger.Error("couldn't query tokens", "err", err)
c.AbortWithStatus(http.StatusInternalServerError)

Check failure on line 85 in web/admin.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: http

Check failure on line 85 in web/admin.go

View workflow job for this annotation

GitHub Actions / lint (./...)

undefined: http
}
}
var infopages []model.InfoPage
Expand All @@ -93,7 +91,7 @@
infopages, err = r.InfoPageDao.GetAll()
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
logger.Error("couldn't query texts", "err", err)
c.AbortWithStatus(http.StatusInternalServerError)

Check failure on line 94 in web/admin.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: http

Check failure on line 94 in web/admin.go

View workflow job for this annotation

GitHub Actions / lint (./...)

undefined: http
}
}
if c.Request.URL.Path == "/admin/server-stats" {
Expand Down Expand Up @@ -150,7 +148,7 @@
foundContext, exists := c.Get("TUMLiveContext")
if !exists {
sentry.CaptureException(errors.New("context should exist but doesn't"))
c.AbortWithStatus(http.StatusInternalServerError)

Check failure on line 151 in web/admin.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: http

Check failure on line 151 in web/admin.go

View workflow job for this annotation

GitHub Actions / lint (./...)

undefined: http
return
}
tumLiveContext := foundContext.(tools.TUMLiveContext)
Expand All @@ -163,7 +161,7 @@
foundContext, exists := c.Get("TUMLiveContext")
if !exists {
sentry.CaptureException(errors.New("context should exist but doesn't"))
c.AbortWithStatus(http.StatusInternalServerError)

Check failure on line 164 in web/admin.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: http

Check failure on line 164 in web/admin.go

View workflow job for this annotation

GitHub Actions / lint (./...)

undefined: http
return
}
tumLiveContext := foundContext.(tools.TUMLiveContext)
Expand All @@ -182,7 +180,7 @@
foundContext, exists := c.Get("TUMLiveContext")
if !exists {
sentry.CaptureException(errors.New("context should exist but doesn't"))
c.AbortWithStatus(http.StatusInternalServerError)

Check failure on line 183 in web/admin.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: http

Check failure on line 183 in web/admin.go

View workflow job for this annotation

GitHub Actions / lint (./...)

undefined: http
return
}
tumLiveContext := foundContext.(tools.TUMLiveContext)
Expand All @@ -200,7 +198,7 @@
foundContext, exists := c.Get("TUMLiveContext")
if !exists {
sentry.CaptureException(errors.New("context should exist but doesn't"))
c.AbortWithStatus(http.StatusInternalServerError)

Check failure on line 201 in web/admin.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: http

Check failure on line 201 in web/admin.go

View workflow job for this annotation

GitHub Actions / lint (./...)

undefined: http
return
}
tumLiveContext := foundContext.(tools.TUMLiveContext)
Expand Down Expand Up @@ -229,7 +227,7 @@
foundContext, exists := c.Get("TUMLiveContext")
if !exists {
sentry.CaptureException(errors.New("context should exist but doesn't"))
c.AbortWithStatus(http.StatusInternalServerError)

Check failure on line 230 in web/admin.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: http

Check failure on line 230 in web/admin.go

View workflow job for this annotation

GitHub Actions / lint (./...)

undefined: http
return
}
tumLiveContext := foundContext.(tools.TUMLiveContext)
Expand Down Expand Up @@ -270,7 +268,7 @@
foundContext, exists := c.Get("TUMLiveContext")
if !exists {
sentry.CaptureException(errors.New("context should exist but doesn't"))
c.AbortWithStatus(http.StatusInternalServerError)

Check failure on line 271 in web/admin.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: http

Check failure on line 271 in web/admin.go

View workflow job for this annotation

GitHub Actions / lint (./...)

undefined: http
return
}
tumLiveContext := foundContext.(tools.TUMLiveContext)
Expand Down
Loading