|
|
@@ -153,6 +153,7 @@ func CountData(wikiCountMap map[string]int) { |
|
|
|
CommitDatasetSizeMap := queryDatasetSize(start_unix, end_unix) |
|
|
|
SolveIssueCountMap := querySolveIssue(start_unix, end_unix) |
|
|
|
CreateRepoCountMap := queryUserCreateRepo(start_unix, end_unix) |
|
|
|
LoginCountMap := queryLoginCount(start_unix, end_unix) |
|
|
|
|
|
|
|
for i, userRecord := range userList { |
|
|
|
var dateRecord UserBusinessAnalysis |
|
|
@@ -235,6 +236,12 @@ func CountData(wikiCountMap map[string]int) { |
|
|
|
dateRecord.CreateRepoCount = CreateRepoCountMap[dateRecord.ID] |
|
|
|
} |
|
|
|
|
|
|
|
if _, ok := LoginCountMap[dateRecord.ID]; !ok { |
|
|
|
dateRecord.LoginCount = 0 |
|
|
|
} else { |
|
|
|
dateRecord.LoginCount = LoginCountMap[dateRecord.ID] |
|
|
|
} |
|
|
|
|
|
|
|
dateRecord.CommitModelCount = 0 |
|
|
|
|
|
|
|
statictisSess := xStatistic.NewSession() |
|
|
@@ -421,6 +428,24 @@ func queryUserCreateRepo(start_unix int64, end_unix int64) map[int64]int { |
|
|
|
return resultMap |
|
|
|
} |
|
|
|
|
|
|
|
func queryLoginCount(start_unix int64, end_unix int64) map[int64]int { |
|
|
|
statictisSess := xStatistic.NewSession() |
|
|
|
defer statictisSess.Close() |
|
|
|
statictisSess.Select("id,u_id").Table("user_login_log").Where("created_unix>=" + fmt.Sprint(start_unix) + " and created_unix<=" + fmt.Sprint(end_unix)) |
|
|
|
userLoginLogList := make([]*UserLoginLog, 0) |
|
|
|
statictisSess.Find(&userLoginLogList) |
|
|
|
resultMap := make(map[int64]int) |
|
|
|
log.Info("query user login size=" + fmt.Sprint(len(userLoginLogList))) |
|
|
|
for _, loginRecord := range userLoginLogList { |
|
|
|
if _, ok := resultMap[loginRecord.UId]; !ok { |
|
|
|
resultMap[loginRecord.UId] = 1 |
|
|
|
} else { |
|
|
|
resultMap[loginRecord.UId] += 1 |
|
|
|
} |
|
|
|
} |
|
|
|
return resultMap |
|
|
|
} |
|
|
|
|
|
|
|
func subMonth(t1, t2 time.Time) (month int) { |
|
|
|
y1 := t1.Year() |
|
|
|
y2 := t2.Year() |
|
|
|