diff options
| author | William Hergès <william@herges.fr> | 2025-12-30 19:41:23 +0100 |
|---|---|---|
| committer | William Hergès <william@herges.fr> | 2025-12-30 19:41:23 +0100 |
| commit | bdd4b6acecb8011d01d47aaf6b8916b16c31fbc9 (patch) | |
| tree | 96a2eaab15c4f3580a72522004ad9e93343cf115 | |
| parent | 012e5b2b4e2866b24f90755dafe7f62584e3e6af (diff) | |
feat(backend): does not update stats if user is admin
| -rw-r--r-- | backend/router.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/backend/router.go b/backend/router.go index e11db94..3928119 100644 --- a/backend/router.go +++ b/backend/router.go @@ -124,8 +124,12 @@ func NewRouter(debug bool, cfg *Config, db *sql.DB, assets fs.FS) *chi.Mux { if strings.HasPrefix(r.RequestURI, "/static") { return } - statusCode := GetStatusCode(ctx)() logger := GetLogger(ctx) + if ctx.Value(loginKey).(bool) { + logger.Debug("not updating stats because user is admin logged") + return + } + statusCode := GetStatusCode(ctx)() if statusCode >= 299 && r.RequestURI != storage.HumanPageLoad { logger.Debug("not updating stats for status code above 299", "status", statusCode) return |
