|
@@ -89,7 +89,7 @@ type UserBusinessAnalysis struct { |
|
|
//action :ActionCommitRepo // 5 |
|
|
//action :ActionCommitRepo // 5 |
|
|
CommitCount int `xorm:"NOT NULL DEFAULT 0"` |
|
|
CommitCount int `xorm:"NOT NULL DEFAULT 0"` |
|
|
|
|
|
|
|
|
//action :ActionCreateIssue // 10 |
|
|
|
|
|
|
|
|
//action :ActionCreateIssue // 6 |
|
|
IssueCount int `xorm:"NOT NULL DEFAULT 0"` |
|
|
IssueCount int `xorm:"NOT NULL DEFAULT 0"` |
|
|
|
|
|
|
|
|
//comment table current date |
|
|
//comment table current date |
|
@@ -406,7 +406,7 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, |
|
|
|
|
|
|
|
|
DataDate := startTime.Format("2006-01-02") |
|
|
DataDate := startTime.Format("2006-01-02") |
|
|
CodeMergeCountMap := queryPullRequest(start_unix, end_unix) |
|
|
CodeMergeCountMap := queryPullRequest(start_unix, end_unix) |
|
|
CommitCountMap := queryAction(start_unix, end_unix, 5) |
|
|
|
|
|
|
|
|
CommitCountMap := queryCommitAction(start_unix, end_unix, 5) |
|
|
IssueCountMap := queryAction(start_unix, end_unix, 6) |
|
|
IssueCountMap := queryAction(start_unix, end_unix, 6) |
|
|
|
|
|
|
|
|
CommentCountMap := queryComment(start_unix, end_unix) |
|
|
CommentCountMap := queryComment(start_unix, end_unix) |
|
@@ -674,6 +674,24 @@ func queryPullRequest(start_unix int64, end_unix int64) map[int64]int { |
|
|
return resultMap |
|
|
return resultMap |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func queryCommitAction(start_unix int64, end_unix int64, actionType int64) map[int64]int { |
|
|
|
|
|
sess := x.NewSession() |
|
|
|
|
|
defer sess.Close() |
|
|
|
|
|
sess.Select("id,user_id,op_type,act_user_id").Table("action").Where("user_id=act_user_id and op_type=" + fmt.Sprint(actionType) + " and created_unix>=" + fmt.Sprint(start_unix) + " and created_unix<=" + fmt.Sprint(end_unix)) |
|
|
|
|
|
actionList := make([]*Action, 0) |
|
|
|
|
|
sess.Find(&actionList) |
|
|
|
|
|
resultMap := make(map[int64]int) |
|
|
|
|
|
log.Info("query action size=" + fmt.Sprint(len(actionList))) |
|
|
|
|
|
for _, actionRecord := range actionList { |
|
|
|
|
|
if _, ok := resultMap[actionRecord.UserID]; !ok { |
|
|
|
|
|
resultMap[actionRecord.UserID] = 1 |
|
|
|
|
|
} else { |
|
|
|
|
|
resultMap[actionRecord.UserID] += 1 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return resultMap |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func queryAction(start_unix int64, end_unix int64, actionType int64) map[int64]int { |
|
|
func queryAction(start_unix int64, end_unix int64, actionType int64) map[int64]int { |
|
|
sess := x.NewSession() |
|
|
sess := x.NewSession() |
|
|
defer sess.Close() |
|
|
defer sess.Close() |
|
|