Things work together
This commit is contained in:
parent
132a726744
commit
8d45e846ff
|
@ -94,17 +94,33 @@ var TeamStats = React.createClass({
|
|||
});
|
||||
|
||||
var UserStats = React.createClass({
|
||||
mixins: [Router.Navigation, Router.State],
|
||||
render: function(){
|
||||
var topRepos = "/api/stat/users/top"+
|
||||
"?org="+ this.getParams().org +
|
||||
"&author="+ this.getParams().user +
|
||||
"&item=repo",
|
||||
repoURL = "/app/"+ this.getParams().org +"/repos/";
|
||||
return (
|
||||
<section className="content">User stats!</section>
|
||||
<section className="content">
|
||||
<BarChart api={topRepos} link={repoURL}/>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
var RepoStats = React.createClass({
|
||||
mixins: [Router.Navigation, Router.State],
|
||||
render: function(){
|
||||
var topAuthors = "/api/stat/repos/top"+
|
||||
"?org="+ this.getParams().org +
|
||||
"&repo="+ this.getParams().repo +
|
||||
"&item=author",
|
||||
userURL = "/app/"+ this.getParams().org +"/users/";
|
||||
return (
|
||||
<section className="content">Repo Stats!</section>
|
||||
<section className="content">
|
||||
<BarChart api={topAuthors} link={userURL}/>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -105,6 +105,7 @@ select
|
|||
from contribs c
|
||||
where
|
||||
c.owner = :org and
|
||||
c.author = :author and
|
||||
c.week >= :from and
|
||||
c.week <= :to
|
||||
group by item
|
||||
|
@ -119,6 +120,7 @@ select
|
|||
from contribs c
|
||||
where
|
||||
c.owner = :org and
|
||||
c.author = :author and
|
||||
c.week >= :from and
|
||||
c.week <= :to
|
||||
group by item
|
||||
|
@ -126,7 +128,7 @@ order by week, commits desc`
|
|||
|
||||
const repoTopQuery = `
|
||||
select
|
||||
%s as item,
|
||||
c.author as item,
|
||||
sum(c.commits) as commits,
|
||||
sum(c.additions) - sum(c.deletions) as delta
|
||||
from contribs c
|
||||
|
@ -179,7 +181,7 @@ func StatOrgActivity(p map[string]interface{}) (res []StatPoint) {
|
|||
|
||||
func StatTeamTop(p map[string]interface{}) (res []StatItem) {
|
||||
defer measure("StatTeamTop", time.Now())
|
||||
mustSelectN(&res, fmt.Sprintf(teamTopQuery, p["item"], p["sort"]), p)
|
||||
mustSelectN(&res, fmt.Sprintf(teamTopQuery, p["item"]), p)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,8 @@ type (
|
|||
statRequest struct {
|
||||
Org string `structs:"org"`
|
||||
Team string `structs:"team"`
|
||||
User string `structs:"user"`
|
||||
Author string `structs:"author"`
|
||||
Repo string `structs:"repo"`
|
||||
From int64 `structs:"from"`
|
||||
To int64 `structs:"to"`
|
||||
Item string `structs:"item"`
|
||||
|
@ -86,7 +87,8 @@ func parseStatRequest(r *http.Request) *statRequest {
|
|||
return &statRequest{
|
||||
Org: r.FormValue("org"),
|
||||
Team: r.FormValue("team"),
|
||||
User: r.FormValue("user"),
|
||||
Author: r.FormValue("author"),
|
||||
Repo: r.FormValue("repo"),
|
||||
From: from,
|
||||
To: to,
|
||||
Item: item,
|
||||
|
|
Loading…
Reference in New Issue