@@ -138,7 +138,7 @@ func GetProjectsSummaryData(ctx *context.Context) {
var datas = make([]*ProjectSummaryBaseData, 0)
recordBeginTime, err := getRecordBeginTime()
recordBeginTime, err := getGrowth RecordBeginTime()
if err != nil {
log.Error("Can not get record begin time", err)
ctx.Error(http.StatusBadRequest, ctx.Tr("repo.record_begintime_get_err"))
@@ -240,6 +240,8 @@ func getEndOfMonthDates(beginTime time.Time, endTime time.Time) []string {
}
}
dates = append(dates, endTime.AddDate(0, 0, -1).Format(DATE_FORMAT))
return dates
}
@@ -386,7 +388,7 @@ func ServeAllProjectsPeriodStatisticsFile(ctx *context.Context) {
func GetProjectsSummaryDataFile(ctx *context.Context) {
recordBeginTime, err := getRecordBeginTime()
recordBeginTime, err := getGrowth RecordBeginTime()
if err != nil {
log.Error("Can not get record begin time", err)
ctx.Error(http.StatusBadRequest, ctx.Tr("repo.record_begintime_get_err"))
@@ -573,6 +575,9 @@ func getFileName(ctx *context.Context, beginTime time.Time, endTime time.Time, p
}
if ctx.QueryTrim("type") == "all" {
baseName = baseName + ctx.Tr("repo.all")
} else if ctx.QueryTrim("type") == "last_month" {
baseName = baseName + beginTime.AddDate(0, 0, -1).Format(EXCEL_DATE_FORMAT) + "_" + endTime.AddDate(0, 0, -2).Format(EXCEL_DATE_FORMAT)
} else {
baseName = baseName + beginTime.AddDate(0, 0, -1).Format(EXCEL_DATE_FORMAT) + "_" + endTime.AddDate(0, 0, -1).Format(EXCEL_DATE_FORMAT)
}
@@ -587,6 +592,8 @@ func getSummaryFileName(ctx *context.Context, beginTime time.Time, endTime time.
baseName = baseName + ctx.Tr("repo.all")
} else if ctx.QueryTrim("type") == "current_year" {
baseName = baseName + ctx.Tr("repo.current_year")
} else if ctx.QueryTrim("type") == "last_month" {
baseName = baseName + beginTime.Format(EXCEL_DATE_FORMAT) + "_" + endTime.AddDate(0, 0, -2).Format(EXCEL_DATE_FORMAT)
} else {
baseName = baseName + beginTime.Format(EXCEL_DATE_FORMAT) + "_" + endTime.AddDate(0, 0, -1).Format(EXCEL_DATE_FORMAT)
}
@@ -950,6 +957,10 @@ func getRecordBeginTime() (time.Time, error) {
return time.ParseInLocation(DATE_FORMAT, setting.RadarMap.RecordBeginTime, time.Local)
}
func getGrowthRecordBeginTime() (time.Time, error) {
return time.ParseInLocation(DATE_FORMAT, setting.RadarMap.GrowthBeginTime, time.Local)
}
func getTotalPage(total int64, pageSize int) int {
another := 0