|
|
|
@@ -135,7 +135,7 @@ func CountData(wikiCountMap map[string]int) { |
|
|
|
|
|
|
|
CountDate := time.Date(currentTimeNow.Year(), currentTimeNow.Month(), currentTimeNow.Day(), 0, 1, 0, 0, currentTimeNow.Location()) |
|
|
|
|
|
|
|
CodeMergeCountMap := queryAction(start_unix, end_unix, 11) |
|
|
|
CodeMergeCountMap := queryPullRequest(start_unix, end_unix) |
|
|
|
CommitCountMap := queryAction(start_unix, end_unix, 5) |
|
|
|
IssueCountMap := queryAction(start_unix, end_unix, 10) |
|
|
|
|
|
|
|
@@ -266,6 +266,28 @@ func querySolveIssue(start_unix int64, end_unix int64) map[int64]int { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func queryPullRequest(start_unix int64, end_unix int64) map[int64]int { |
|
|
|
sess := x.NewSession() |
|
|
|
defer sess.Close() |
|
|
|
|
|
|
|
sess.Select("issue.*").Table("issue"). |
|
|
|
Join("inner", "pull_request", "issue.id=pull_request.issue_id"). |
|
|
|
Where("pull_request.merged_unix>=" + fmt.Sprint(start_unix) + " and pull_request.merged_unix<=" + fmt.Sprint(end_unix)) |
|
|
|
|
|
|
|
issueList := make([]*Issue, 0) |
|
|
|
sess.Find(&issueList) |
|
|
|
resultMap := make(map[int64]int) |
|
|
|
log.Info("query issue(PR) size=" + fmt.Sprint(len(issueList))) |
|
|
|
for _, issueRecord := range issueList { |
|
|
|
if _, ok := resultMap[issueRecord.PosterID]; !ok { |
|
|
|
resultMap[issueRecord.PosterID] = 1 |
|
|
|
} else { |
|
|
|
resultMap[issueRecord.PosterID] += 1 |
|
|
|
} |
|
|
|
} |
|
|
|
return resultMap |
|
|
|
} |
|
|
|
|
|
|
|
func queryAction(start_unix int64, end_unix int64, actionType int64) map[int64]int { |
|
|
|
sess := x.NewSession() |
|
|
|
defer sess.Close() |
|
|
|
@@ -384,7 +406,7 @@ 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)) |
|
|
|
sess.Select("id,owner_id,name").Table("repository").Where("is_fork=false and 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) |
|
|
|
@@ -397,7 +419,6 @@ func queryUserCreateRepo(start_unix int64, end_unix int64) map[int64]int { |
|
|
|
} |
|
|
|
} |
|
|
|
return resultMap |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func subMonth(t1, t2 time.Time) (month int) { |
|
|
|
|