Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.21.12.1
zouap 3 years ago
parent
commit
5997574918
2 changed files with 16 additions and 8 deletions
  1. +10
    -2
      models/user_business_analysis.go
  2. +6
    -6
      routers/repo/user_data_analysis.go

+ 10
- 2
models/user_business_analysis.go View File

@@ -245,7 +245,8 @@ func QueryUserStaticDataPage(opts *UserBusinessAnalysisQueryOptions) ([]*UserBus
return userBusinessAnalysisReturnList, count
}

func CounDataByDate(wikiCountMap map[string]int, startTime time.Time, endTime time.Time) {
func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, endTime time.Time, isReCount bool) {

log.Info("start to count other user info data")
sess := x.NewSession()
defer sess.Close()
@@ -263,8 +264,11 @@ func CounDataByDate(wikiCountMap map[string]int, startTime time.Time, endTime ti

//endTime := time.Date(currentTimeNow.Year(), currentTimeNow.Month(), currentTimeNow.Day(), 0, 0, 0, 0, currentTimeNow.Location())
end_unix := endTime.Unix()
CountDate := time.Date(currentTimeNow.Year(), currentTimeNow.Month(), currentTimeNow.Day(), 0, 1, 0, 0, currentTimeNow.Location())
if isReCount {
CountDate = time.Date(startTime.Year(), startTime.Month(), startTime.Day(), 0, 1, 0, 0, startTime.Location())
}

CountDate := time.Date(startTime.Year(), startTime.Month(), startTime.Day(), 0, 1, 0, 0, startTime.Location())
DataDate := startTime.Format("2006-01-02")
CodeMergeCountMap := queryPullRequest(start_unix, end_unix)
CommitCountMap := queryAction(start_unix, end_unix, 5)
@@ -394,6 +398,10 @@ func CounDataByDate(wikiCountMap map[string]int, startTime time.Time, endTime ti

}

func CounDataByDate(wikiCountMap map[string]int, startTime time.Time, endTime time.Time) {
CounDataByDateAndReCount(wikiCountMap, startTime, endTime, false)
}

func querySolveIssue(start_unix int64, end_unix int64) map[int64]int {
//select issue_assignees.* from issue_assignees,issue where issue.is_closed=true and issue.id=issue_assignees.issue_id
sess := x.NewSession()


+ 6
- 6
routers/repo/user_data_analysis.go View File

@@ -58,8 +58,7 @@ func QueryUserStaticDataPage(ctx *context.Context) {
ctx.JSON(http.StatusOK, mapInterface)
}

func TimingCountDataByDate(date string) {

func TimingCountDataByDateAndReCount(date string, isReCount bool) {
t, _ := time.Parse("2006-01-02", date)
startTime := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())

@@ -106,16 +105,17 @@ func TimingCountDataByDate(date string) {
}
}
//other user info data
models.CounDataByDate(wikiMap, startTime, endTime)
models.CounDataByDateAndReCount(wikiMap, startTime, endTime, isReCount)
}

func TimingCountDataByDate(date string) {
TimingCountDataByDateAndReCount(date, true)
}

func TimingCountData() {

log.Info("start to time count data")
currentTimeNow := time.Now()
log.Info("current time:" + currentTimeNow.Format("2006-01-02 15:04:05"))
startTime := currentTimeNow.AddDate(0, 0, -1).Format("2006-01-02")

TimingCountDataByDate(startTime)
TimingCountDataByDateAndReCount(startTime, false)
}

Loading…
Cancel
Save