diff --git a/routers/repo/repo_statistic.go b/routers/repo/repo_statistic.go index 6ee5c9a59..38db0f5cb 100755 --- a/routers/repo/repo_statistic.go +++ b/routers/repo/repo_statistic.go @@ -30,11 +30,15 @@ func RepoStatisticDaily(date string) { for _, repo := range repos { log.Info("start statistic: %s", repo.Name) + var numDevMonths,numWikiViews,numContributor,numKeyContributor int64 repoGitStat, err := models.GetRepoKPIStats(repo) if err != nil { log.Error("GetRepoKPIStats failed: %s", repo.Name) - log.Error("failed statistic: %s", repo.Name) - continue + } else { + numDevMonths = repoGitStat.DevelopAge + numKeyContributor = repoGitStat.KeyContributors + numWikiViews = repoGitStat.WikiPages + numContributor = repoGitStat.Contributors } var issueFixedRate float32 @@ -42,32 +46,29 @@ func RepoStatisticDaily(date string) { issueFixedRate = float32(repo.NumClosedIssues) / float32(repo.NumIssues) } - numVersions, err := models.GetReleaseCountByRepoID(repo.ID, models.FindReleasesOptions{}) + var numVersions int64 + numVersions, err = models.GetReleaseCountByRepoID(repo.ID, models.FindReleasesOptions{}) if err != nil { - log.Error("GetReleaseCountByRepoID failed: %s", repo.Name) - log.Error("failed statistic: %s", repo.Name) - continue + log.Error("GetReleaseCountByRepoID failed(%s): %v", repo.Name, err) } - datasetSize, err := getDatasetSize(repo) + var datasetSize int64 + datasetSize, err = getDatasetSize(repo) if err != nil { - log.Error("getDatasetSize failed: %s", repo.Name) - log.Error("failed statistic: %s", repo.Name) - continue + log.Error("getDatasetSize failed(%s): %v", repo.Name, err) } - numComments, err := models.GetCommentCountByRepoID(repo.ID) + var numComments int64 + numComments, err = models.GetCommentCountByRepoID(repo.ID) if err != nil { - log.Error("GetCommentCountByRepoID failed: %s", repo.Name) - log.Error("failed statistic: %s", repo.Name) - continue + log.Error("GetCommentCountByRepoID failed(%s): %v", repo.Name, err) } beginTime, endTime := getStatTime(date) - numVisits, err := repository.AppointProjectView(repo.OwnerName, repo.Name, beginTime, endTime) + var numVisits int + numVisits, err = repository.AppointProjectView(repo.OwnerName, repo.Name, beginTime, endTime) if err != nil { - log.Error("Get numVisits failed", err) - numVisits = 0 + log.Error("AppointProjectView failed(%s): %v", repo.Name, err) } repoStat := models.RepoStatistic{ @@ -80,21 +81,21 @@ func RepoStatisticDaily(date string) { NumVisits: int64(numVisits), NumClosedIssues: int64(repo.NumClosedIssues), NumVersions: numVersions, - NumDevMonths: repoGitStat.DevelopAge, + NumDevMonths: numDevMonths, RepoSize: repo.Size, DatasetSize: datasetSize, NumModels: 0, - NumWikiViews: repoGitStat.WikiPages, + NumWikiViews: numWikiViews, NumCommits: repo.NumCommit, NumIssues: int64(repo.NumIssues), NumPulls: int64(repo.NumPulls), IssueFixedRate: issueFixedRate, - NumContributor: repoGitStat.Contributors, - NumKeyContributor: repoGitStat.KeyContributors, + NumContributor: numContributor, + NumKeyContributor: numKeyContributor, } if _, err = models.InsertRepoStat(&repoStat); err != nil { - log.Error("InsertRepoStat failed: %s", repo.Name) + log.Error("InsertRepoStat failed(%s): %v", repo.Name, err) log.Error("failed statistic: %s", repo.Name) continue } diff --git a/templates/repo/datasets/dataset_list.tmpl b/templates/repo/datasets/dataset_list.tmpl index 5cb35aa77..e0c69c745 100755 --- a/templates/repo/datasets/dataset_list.tmpl +++ b/templates/repo/datasets/dataset_list.tmpl @@ -17,7 +17,7 @@ {{svg "octicon-file-binary" 16}} - {{if ne .DecompressState 0}} + {{if eq .DecompressState 1}}
{{svg "octicon-file-directory" 16}} {{if $.IsSigned}}