Browse Source

Merge pull request '修复项目指标增量数据记录不对的问题' (#724) from V20211101.patch into develop

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/724
Reviewed-by: lewis <747342561@qq.com>
pull/993/head
lewis 3 years ago
parent
commit
09cef2a2f8
2 changed files with 3 additions and 3 deletions
  1. +2
    -2
      models/repo_statistic.go
  2. +1
    -1
      routers/repo/repo_statistic.go

+ 2
- 2
models/repo_statistic.go View File

@@ -81,9 +81,9 @@ func DeleteRepoStatDaily(date string) error {
return nil
}

func GetRepoStatisticByDate(date string) ([]*RepoStatistic, error) {
func GetRepoStatisticByDate(date string, repoId int64) ([]*RepoStatistic, error) {
repoStatistics := make([]*RepoStatistic, 0)
err := xStatistic.Where("date = ?", date).Find(&repoStatistics)
err := xStatistic.Where("date = ? and repo_id=?", date, repoId).Find(&repoStatistics)
return repoStatistics, err

}


+ 1
- 1
routers/repo/repo_statistic.go View File

@@ -115,7 +115,7 @@ func RepoStatisticDaily(date string) {
}

dayBeforeDate := t.AddDate(0, 0, -1).Format("2006-01-02")
repoStatisticsBefore, err := models.GetRepoStatisticByDate(dayBeforeDate)
repoStatisticsBefore, err := models.GetRepoStatisticByDate(dayBeforeDate, repo.ID)

if err != nil {
log.Error("get data of day before the date failed ", err)


Loading…
Cancel
Save