Browse Source

opt

tags/v1.21.12.1
lewis 4 years ago
parent
commit
b092e7077f
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      routers/repo/repo_statistic.go

+ 8
- 0
routers/repo/repo_statistic.go View File

@@ -1,6 +1,7 @@
package repo

import (
"errors"
"time"

"code.gitea.io/gitea/models"
@@ -286,6 +287,13 @@ func UpdateRepoVisits(ctx *macaron.Context, repo *models.Repository, date string
}

repoStat, err := models.GetRepoStatisticByDate(date, repo.ID)
if err != nil {
log.Error("GetRepoStatisticByDate failed(%s): %v", getDistinctProjectName(repo), err)
return err
} else if len(repoStat) != 1 {
log.Error("GetRepoStatisticByDate failed(%s): %v", getDistinctProjectName(repo), err)
return errors.New("not find repo")
}
repoStat[0].NumVisits = int64(numVisits)

if err = models.UpdateRepoStatVisits(repoStat[0]); err != nil {


Loading…
Cancel
Save