Browse Source

提交代码

tags/v1.22.3.2^2
yanchao 3 years ago
parent
commit
b9183e58a2
3 changed files with 33 additions and 0 deletions
  1. +5
    -0
      models/summary_statistic.go
  2. +2
    -0
      routers/repo/repo_statistic.go
  3. +26
    -0
      routers/repo/repo_summary_statistic.go

+ 5
- 0
models/summary_statistic.go View File

@@ -40,6 +40,11 @@ type SummaryStatistic struct {
NumRepoLeagueLearn int `xorm:"NOT NULL DEFAULT 0"`
NumRepoDataMining int `xorm:"NOT NULL DEFAULT 0"`
NumRepoRISC int `xorm:"NOT NULL DEFAULT 0"`
NumRepoPublic int64 `xorm:"NOT NULL DEFAULT 0"`
NumRepoPrivate int64 `xorm:"NOT NULL DEFAULT 0"`
NumRepoFork int64 `xorm:"NOT NULL DEFAULT 0"`
NumRepoMirror int64 `xorm:"NOT NULL DEFAULT 0"`
NumRepoSelf int64 `xorm:"NOT NULL DEFAULT 0"`
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
}


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

@@ -110,6 +110,8 @@ func RepoStatisticDaily(date string) {
Alias: repo.Alias,
IsPrivate: repo.IsPrivate,
IsMirror: repo.IsMirror,
IsFork: repo.IsFork,
RepoCreatedUnix: repo.CreatedUnix,
OwnerName: repo.OwnerName,
NumWatches: int64(repo.NumWatches),
NumStars: int64(repo.NumStars),


+ 26
- 0
routers/repo/repo_summary_statistic.go View File

@@ -39,6 +39,27 @@ func SummaryStatisticDaily(date string) {
log.Error("can not get repository number", err)
repositoryNumer = 0
}

publicRepositoryNumer, err := models.GetAllPublicRepositoriesCount()
if err != nil {
log.Error("can not get public repository number", err)
publicRepositoryNumer = 0
}

privateRepositoryNumer := repositoryNumer - publicRepositoryNumer

mirrorRepositoryNumber, err := models.GetAllMirrorRepositoriesCount()
if err != nil {
log.Error("can not get mirror repository number", err)
mirrorRepositoryNumber = 0
}
forkRepositoryNumber, err := models.GetAllForkRepositoriesCount()
if err != nil {
log.Error("can not get fork mirror repository number", err)
forkRepositoryNumber = 0
}
selfRepositoryNumber := repositoryNumer - mirrorRepositoryNumber - forkRepositoryNumber

//repository size
repositorySize, err := models.GetAllRepositoriesSize()
if err != nil {
@@ -73,6 +94,11 @@ func SummaryStatisticDaily(date string) {
DatasetSize: allDatasetSize,
NumOrganizations: organizationNumber,
NumRepos: repositoryNumer,
NumRepoFork: forkRepositoryNumber,
NumRepoMirror: mirrorRepositoryNumber,
NumRepoPrivate: privateRepositoryNumer,
NumRepoPublic: publicRepositoryNumer,
NumRepoSelf: selfRepositoryNumber,
NumRepoBigModel: topicsCount[0],
NumRepoAI: topicsCount[1],
NumRepoVision: topicsCount[2],


Loading…
Cancel
Save