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