|
|
|
@@ -55,6 +55,15 @@ type UserBusinessAnalysis struct { |
|
|
|
//user |
|
|
|
RegistDate timeutil.TimeStamp `xorm:"NOT NULL"` |
|
|
|
|
|
|
|
//repo |
|
|
|
CreateRepoCount int `xorm:"NOT NULL DEFAULT 0"` |
|
|
|
|
|
|
|
//login count, from elk |
|
|
|
LoginCount int `xorm:"NOT NULL DEFAULT 0"` |
|
|
|
|
|
|
|
//openi index |
|
|
|
OpenIIndex int `xorm:"NOT NULL DEFAULT 0"` |
|
|
|
|
|
|
|
//user |
|
|
|
Email string `xorm:"NOT NULL"` |
|
|
|
|
|
|
|
@@ -100,6 +109,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) |
|
|
|
|
|
|
|
for i, userRecord := range userList { |
|
|
|
var dateRecord UserBusinessAnalysis |
|
|
|
@@ -176,6 +186,12 @@ func CountData(wikiCountMap map[string]int) { |
|
|
|
dateRecord.EncyclopediasCount = wikiCountMap[dateRecord.Name] |
|
|
|
} |
|
|
|
|
|
|
|
if _, ok := CreateRepoCountMap[dateRecord.ID]; !ok { |
|
|
|
dateRecord.CreateRepoCount = 0 |
|
|
|
} else { |
|
|
|
dateRecord.CreateRepoCount = CreateRepoCountMap[dateRecord.ID] |
|
|
|
} |
|
|
|
|
|
|
|
dateRecord.CommitModelCount = 0 |
|
|
|
|
|
|
|
statictisSess := xStatistic.NewSession() |
|
|
|
@@ -322,6 +338,25 @@ func queryDatasetSize(start_unix int64, end_unix int64) map[int64]int { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func queryUserCreateRepo(start_unix int64, end_unix int64) map[int64]int { |
|
|
|
sess := x.NewSession() |
|
|
|
defer sess.Close() |
|
|
|
sess.Select("id,owner_id,name").Table("repository").Where(" created_unix>=" + fmt.Sprint(start_unix) + " and created_unix<=" + fmt.Sprint(end_unix)) |
|
|
|
repoList := make([]*Repository, 0) |
|
|
|
sess.Find(&repoList) |
|
|
|
resultMap := make(map[int64]int) |
|
|
|
log.Info("query Repository size=" + fmt.Sprint(len(repoList))) |
|
|
|
for _, repoRecord := range repoList { |
|
|
|
if _, ok := resultMap[repoRecord.OwnerID]; !ok { |
|
|
|
resultMap[repoRecord.OwnerID] = 1 |
|
|
|
} else { |
|
|
|
resultMap[repoRecord.OwnerID] += 1 |
|
|
|
} |
|
|
|
} |
|
|
|
return resultMap |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func subMonth(t1, t2 time.Time) (month int) { |
|
|
|
y1 := t1.Year() |
|
|
|
y2 := t2.Year() |
|
|
|
|