diff --git a/app/scripts/app.jsx b/app/scripts/app.jsx
index ecbae7a..42bbb86 100644
--- a/app/scripts/app.jsx
+++ b/app/scripts/app.jsx
@@ -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 (
-
+
);
}
});
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 (
-
+
);
}
});
diff --git a/db/stat.go b/db/stat.go
index 3a56f92..2fba435 100644
--- a/db/stat.go
+++ b/db/stat.go
@@ -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
}
diff --git a/server/request.go b/server/request.go
index ef01670..f230a06 100644
--- a/server/request.go
+++ b/server/request.go
@@ -19,12 +19,13 @@ type (
login string
}
statRequest struct {
- Org string `structs:"org"`
- Team string `structs:"team"`
- User string `structs:"user"`
- From int64 `structs:"from"`
- To int64 `structs:"to"`
- Item string `structs:"item"`
+ Org string `structs:"org"`
+ Team string `structs:"team"`
+ Author string `structs:"author"`
+ Repo string `structs:"repo"`
+ From int64 `structs:"from"`
+ To int64 `structs:"to"`
+ Item string `structs:"item"`
}
)
@@ -84,12 +85,13 @@ func parseStatRequest(r *http.Request) *statRequest {
}
return &statRequest{
- Org: r.FormValue("org"),
- Team: r.FormValue("team"),
- User: r.FormValue("user"),
- From: from,
- To: to,
- Item: item,
+ Org: r.FormValue("org"),
+ Team: r.FormValue("team"),
+ Author: r.FormValue("author"),
+ Repo: r.FormValue("repo"),
+ From: from,
+ To: to,
+ Item: item,
}
}