|
|
@@ -73,6 +73,8 @@ type UserBusinessAnalysis struct { |
|
|
|
|
|
|
|
//user |
|
|
|
Name string `xorm:"NOT NULL"` |
|
|
|
|
|
|
|
DataDate string `xorm:"NOT NULL"` |
|
|
|
} |
|
|
|
|
|
|
|
type UserBusinessAnalysisQueryOptions struct { |
|
|
@@ -263,7 +265,7 @@ func CounDataByDate(wikiCountMap map[string]int, startTime time.Time, endTime ti |
|
|
|
end_unix := endTime.Unix() |
|
|
|
|
|
|
|
CountDate := time.Date(currentTimeNow.Year(), currentTimeNow.Month(), currentTimeNow.Day(), 0, 1, 0, 0, currentTimeNow.Location()) |
|
|
|
|
|
|
|
DataDate := startTime.Format("2006-01-02") |
|
|
|
CodeMergeCountMap := queryPullRequest(start_unix, end_unix) |
|
|
|
CommitCountMap := queryAction(start_unix, end_unix, 5) |
|
|
|
IssueCountMap := queryAction(start_unix, end_unix, 10) |
|
|
@@ -300,6 +302,7 @@ func CounDataByDate(wikiCountMap map[string]int, startTime time.Time, endTime ti |
|
|
|
dateRecord.RegistDate = userRecord.CreatedUnix |
|
|
|
dateRecord.Name = userRecord.Name |
|
|
|
dateRecord.GiteaAgeMonth = subMonth(currentTimeNow, userRecord.CreatedUnix.AsTime()) |
|
|
|
dateRecord.DataDate = DataDate |
|
|
|
if _, ok := CodeMergeCountMap[dateRecord.ID]; !ok { |
|
|
|
dateRecord.CodeMergeCount = 0 |
|
|
|
} else { |
|
|
@@ -522,10 +525,10 @@ func queryFollow(start_unix int64, end_unix int64) map[int64]int { |
|
|
|
resultMap := make(map[int64]int) |
|
|
|
log.Info("query Follow size=" + fmt.Sprint(len(followList))) |
|
|
|
for _, followRecord := range followList { |
|
|
|
if _, ok := resultMap[followRecord.UserID]; !ok { |
|
|
|
resultMap[followRecord.UserID] = 1 |
|
|
|
if _, ok := resultMap[followRecord.FollowID]; !ok { |
|
|
|
resultMap[followRecord.FollowID] = 1 |
|
|
|
} else { |
|
|
|
resultMap[followRecord.UserID] += 1 |
|
|
|
resultMap[followRecord.FollowID] += 1 |
|
|
|
} |
|
|
|
} |
|
|
|
return resultMap |
|
|
|