|
|
@@ -26,13 +26,44 @@ func RepoStatisticDaily() { |
|
|
|
|
|
|
|
for _, repo := range repos { |
|
|
|
log.Info("start statistic: %s", repo.Name) |
|
|
|
repoStat, err := models.GetRepoKPIStats(repo) |
|
|
|
repoGitStat, err := models.GetRepoKPIStats(repo) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetRepoKPIStats failed: %s", repo.Name) |
|
|
|
log.Error("failed statistic: %s", repo.Name) |
|
|
|
continue |
|
|
|
} |
|
|
|
log.Info("", repoStat.DevelopAge) |
|
|
|
log.Info("", repoGitStat.DevelopAge) |
|
|
|
|
|
|
|
repoStat := models.RepoStatistic{ |
|
|
|
RepoID: repo.ID, |
|
|
|
Date:yesterday, |
|
|
|
NumWatches:int64(repo.NumWatches), |
|
|
|
NumStars:int64(repo.NumStars), |
|
|
|
NumDownloads:repo.CloneCnt, |
|
|
|
NumComments:0, |
|
|
|
NumViews:0, |
|
|
|
NumClosedIssues:0, |
|
|
|
NumVersions:0, |
|
|
|
NumDevMonths:repoGitStat.DevelopAge, |
|
|
|
RepoSize:0, |
|
|
|
DatasetSize:0, |
|
|
|
NumModels:0, |
|
|
|
NumWikiViews:0, |
|
|
|
NumCommits:0, |
|
|
|
NumIssues:0, |
|
|
|
NumPulls:0, |
|
|
|
IssueFixedRate:0, |
|
|
|
NumContributor:repoGitStat.Contributors, |
|
|
|
NumKeyContributor:repoGitStat.KeyContributors, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if _, err = models.InsertRepoStat(&repoStat); err != nil { |
|
|
|
log.Error("InsertRepoStat failed: %s", repo.Name) |
|
|
|
log.Error("failed statistic: %s", repo.Name) |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
log.Info("finish statistic: %s", repo.Name) |
|
|
|
} |
|
|
|
|
|
|
|